home *** CD-ROM | disk | FTP | other *** search
/ MaxiMac 2002 March / MaxiMac 124.iso / Macworld on CD n°124 / Logiciels pour Mac OS X / Internet / Utilisation / Snak 4.8 / UserScripts / purepak.irc < prev    next >
Encoding:
Text File  |  2001-11-02  |  106.1 KB  |  3,426 lines  |  [TEXT/R*ch]

  1.  
  2. # Snak adaptation 1.1. Removed handlers that emit conflicting messages and usually made '-'
  3. # Snak adaptation 1.2. Removed unnecessary checks for the correctness of ischanop
  4. # Snak adaptation 1.3. Removed pp.snm and calls to it as Snak does integrated highlighting
  5. # Snak adaptation 1.4. Removed pp.formecho in priv msg and notice handlers as it conflicts with normal message formatting
  6. #                       Removed //who when joining channel and message formatting in /who handler
  7. #                       Removed handlers for mesages 432 and 433 as Snak already does this
  8. #                       Removed message in notify_signon, and made it let Snak continue processing
  9. #                       Change order of handler and exec because execs are handled directly - not handed to the OS
  10. #                       The wait -CMD %<process> returns immediately as true
  11. #                       Removed CTCP handlers for ping, version, finger as Snak already does this
  12. #                       Modified dcc.ucmd.offer so that it asks properly for one or more files
  13. #                       dcc.ucmd.offer uses a variation on /input which asks for files
  14. #                       Because Mac files can contain spaces, the resulting list is separated by tabs, so 
  15. #                       a new function "listitem" is used instead of "word"
  16. #                      Removed fileexist from pp-dcc.irc alias and made a built in function
  17. #                       "Press ENTER to continue" in doechos removed..Snak can scoll.
  18. #                       /dcc save <file> saves package file in the scripts directory
  19. #                       /dcc notice now only sends to the current channel, not all channels.
  20. # Snak adaptation 1.5  the fileserver (/pphelp dcc) now works. Most changes consists of using listitem instead of word
  21. # Snak adaptation 1.6  Snak does its own DCC Autoaccept
  22. #                        Furthermore, the purepak dcc code does not always work because it assumes that there are no spaces 
  23. #                      in the filename. If there is then $6 will be incorrect and the script fails.
  24. # Snak adaptation 1.7  added special "window log_extrainfo off" flag to window creation so that Snaks text logger will
  25. #                       not write "server:" or "info:" before each line. This affects /sve and /dcc.ucmd.save
  26. #                       Removed Purepak 333 topic intercept as it interferes with Snak topic handling
  27. #                       Removed unnecessary (and incorrect) PurePak redefinition of the say alias
  28. # Snak adaptation 1.8  Snak will PING itself every 90 seconds if there is no traffic, so disable the purepak on raw handler
  29. #                       that listens for PONG
  30. #
  31. # To automatically load this into a connection, add "/load purepak.irc" to the startup actions.
  32. #
  33. # ########################################################################## #
  34. #                      PurePak - The sequel to TextBox                       #
  35. #                          A -+ TEXT +- production                           #
  36. # ########################################################################## #
  37. # Author: Crypt Keeper [ckeeper@axiom.access.one.net] (CKeeper on IRC)
  38. # Version 2.07
  39. #
  40. # This script requires at least ircII2.2.9 (Unix) or a fully ircII compatible
  41. # client.  It has only been tested under Unix with ircII2.2.9 and ircII2.8.2.
  42. #
  43. # If you edit this file, you must edit it with a Unix text editor or use
  44. # utilities like dos2unix/unix2dos to convert it to DOS to edit and then
  45. # back to Unix.  If it is edited in a DOS text editor it will be corrupted.
  46. #
  47. # All stolen code is labelled.  If it isn't labelled as stolen code, then it
  48. # is mine.  If you take my code, please give me credit.
  49. #
  50. # PurePak version 2.07 IRC script
  51. # Copyright (C) 1995
  52. #
  53. # This program is free software; you can redistribute it and/or modify
  54. # it under the terms of the GNU General Public License as published by
  55. # the Free Software Foundation; either version 1, or (at your option)
  56. # any later version.
  57. #
  58. # This program is distributed in the hope that it will be useful,
  59. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  60. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  61. # GNU General Public License for more details.
  62. #
  63. # You should have received a copy of the GNU General Public License
  64. # along with this program; if not, write to the Free Software
  65. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  66. # ########################################################################## #
  67.  
  68. ^set novice off
  69. ^set exec_protection off
  70. ^set input_protection off
  71. @ PPVERS = [2.07]
  72.  
  73. # ----------------------------------------------------------------------------
  74. # Sets and key bindings
  75. # ----------------------------------------------------------------------------
  76.  
  77. # See if we're on an EPIC client
  78. EVAL ^if (match(*EPIC* $status_user)) {@ PP.EPIC = 1}
  79.  
  80. EVAL ^set input_prompt [PurePak] version $PPVERS loading...
  81.  
  82. ^set tab on
  83. ^set tab_max 6
  84. ^set send_ignore_msg off
  85. ^set clock_24hour off
  86. ^set clock on
  87. ^set status_away  (away)
  88. ^set user_information [PurePak]
  89. ^set status_user [Lag ??] [PurePak] *
  90. ^set status_query  [Query: %Q]
  91. ^set status_notify  [Activity: %F]
  92. ^set status_oper *
  93. ^set status_overwrite  (overtype)
  94. ^set status_window ^^^^^^^^
  95. ^set status_mode  (+%+)
  96. ^set status_mail  [Mail: %M]
  97. ^set status_server  via %S
  98. ^set channel_name_width 10
  99. ^set debug 0
  100. ^set help_window off
  101. ^set help_prompt on
  102. ^set hold_mode_max 0
  103. ^set input_aliases off
  104. ^set insert_mode on
  105. ^set lastlog 16384
  106. ^set lastlog_level all
  107. ^set scroll on
  108. ^set scroll_lines 1
  109. ^set shell_limit 0
  110. ^set status_hold_lines  (%B)
  111. ^set command_mode off
  112. ^set double_status_line off
  113. ^set suppress_server_motd off
  114. ^set show_end_of_msgs off
  115. ^set beep_when_away 0
  116. EVAL ^set client_information [PurePak] v$PPVERS by Crypt Keeper
  117. ^set status_hold  -- ENTER --
  118. ^set beep_max 2
  119. ^set warn_of_ignores on
  120. ^set verbose_ctcp off
  121. ^set indent on
  122. ^set auto_whowas off
  123. ^set full_status_line on
  124. ^set continued_line  
  125. ^set hide_private_channels off
  126. ^set show_away_once on
  127. ^set history 120
  128. ^set auto_unmark_away off
  129. ^set beep_on_msg NONE
  130. ^set show_channel_names on
  131. ^set show_numerics off
  132. ^set max_recursions 210
  133. ^set log off
  134. ^set logfile irc.log
  135. ^set input_protection off
  136. ^set dcc_block_size 1024
  137. ^set no_ctcp_flood on
  138. ^EVAL ^if ([$mail] == [0]) {^set mail 1}
  139. ^EVAL ^set load_path ~/purepak:./purepak:~:$load_path
  140. ^set hold_mode off
  141. ^set notify_on_termination off
  142. ^set show_who_hopcount off
  143. ^set flood_warning off
  144. ^set flood_rate 1
  145. ^set flood_after 4
  146. ^set flood_users 4
  147. ^EVAL ^set status_format %T %*%@%N%#%Q%S%H%B%A%C%+%I%O%F %W%>%U%M%X%Y%Z 
  148.  
  149. bind ^X meta2
  150. bind ^\ switch_channels
  151. bind ^Q quote_character
  152. bind ^I parse_command ^tk.getmsg 1 $tk.msglist
  153. bind ^R parse_command ^tk.getmsg -1 $tk.msglist
  154. bind ^X^X parse_command tk.delnick
  155. bind ^S toggle_stop_screen
  156. bind ^[ meta1
  157. bind meta1-[ meta2
  158. bind meta1-O meta2
  159. bind meta2-^@ scroll_end
  160. bind meta2-A backward_history
  161. bind meta2-B forward_history
  162. bind meta2-C forward_character
  163. bind meta2-D backward_character
  164. bind meta2-5 parse_command ^s_up
  165. bind meta2-6 parse_command ^s_dn
  166. bind meta2-1 parse_command ^s_end
  167. bind meta2-7 parse_command ^s_end
  168. bind ^X^A scroll_backward
  169. bind ^X^B scroll_forward
  170. bind ^B self_insert
  171. bind ^_ self_insert
  172. bind ^V self_insert
  173. bind ^A self_insert
  174. bind ^O self_insert
  175. bind ^W next_window
  176. bind ^Z stop_irc
  177. bind ^U erase_line
  178.  
  179. alias s_up {
  180.     ^bind ~ nothing
  181.     ^type ^U^X^A^U
  182.     ^timer 1 ^bind ~ self_insert
  183. }
  184. alias s_dn {
  185.     ^bind ~ nothing
  186.     ^type ^U^X^B^U
  187.     ^timer 1 ^bind ~ self_insert
  188. }
  189. alias s_end {
  190.     ^bind ~ nothing
  191.     ^type ^[[^@
  192.     ^timer 1 ^bind ~ self_insert
  193. }
  194.  
  195. # File that settings are saved to
  196. @ PP.SAVEFILE = [purepak.sav]
  197.  
  198. on ^dcc_raw * {}
  199.  
  200. # ----------------------------------------------------------------------------
  201. # Tab key message history (originally from the ircII tabkey script)
  202. # ----------------------------------------------------------------------------
  203.  
  204. alias tk.addmsg {
  205.     @ tk.matched = rmatch($0 $^\1-)
  206.     if (tk.matched)
  207.     {
  208.         @ tk.msglist = [$(0-${tk.matched-1}) $(${tk.matched+1}-)]
  209.     }
  210.     { @ tk.msglist = [$(0-${tk.msgmax-1})] }
  211.     @ tk.msgcnt = 0
  212.     ^assign -tk.matched
  213. }
  214. alias tk.getmsg {
  215.     @ tk.msgcnt = tk.msgcnt + [$0]
  216.     if ( #tk.msglist < tk.msgcnt ) {@ tk.msgcnt = 1}
  217.     if (tk.msgcnt <= 0) {@ tk.msgcnt =  #tk.msglist}
  218.     @ tk.junk = K ## [msg]
  219.     type ^U$tk.junk $^^{[$($tk.msgcnt)]} 
  220. }
  221. alias tk.delnick {
  222.     if (tk.msgcnt == 0)
  223.     {
  224.         echo *** Nickname: $word(0 $tk.msglist) removed.
  225.         @ tk.msglist = [$notword(1 $tk.msglist)]
  226.     }
  227.     {
  228.         echo *** Nickname: $word(${tk.msgcnt-1} $tk.msglist) removed.
  229.         @ tk.msglist = [$notword($tk.msgcnt $tk.msglist)]
  230.     }
  231.     type ^U
  232. }
  233. alias notword {
  234.     if ([$0]>0)
  235.     {
  236.         if (([$0]>1)&&([$0] < rmatch($~ $1-))) {@ nw.sep = [ ]} {@ nw.sep = []}
  237.         @ function_return = [$(1-${[$0]-1})] ## [$nw.sep] ## [$(${[$0]+1}-)]
  238.     } {@ function_return = [$1-]}
  239. }
  240. alias minnot {
  241.     @ noticecnt = 0
  242.     ^assign -lastnoter
  243.     ^assign -ntemp
  244. }
  245.  
  246. # ----------------------------------------------------------------------------
  247. # Miscellaneous functions and aliases, mostly internal
  248. # ----------------------------------------------------------------------------
  249.  
  250. # Lame aliases for buggy clients
  251. # Snak adaptation 1.7. Removed. Snak correctly implements this command
  252. #alias say {
  253. #    quote PRIVMSG $C :$*
  254. #    echo <${N}> $*
  255. #}
  256. alias sendto {
  257.     if (ischannel($0)) {^if ([$0] == C) {/echo <${N}> $1-} {/echo -> $0 <${N}> $1-}} {/echo -> [$0] $1-}
  258.     ^quote PRIVMSG $0 :$1-
  259. }
  260.  
  261. # /me alias that echoes to the right window (some clients don't)
  262. #alias me {
  263. #    xecho -LEVEL CRAP -WINDOW $winnum() * $N $*
  264. #    quote PRIVMSG $C :ACTION $*
  265. #}
  266.  
  267. # Repeats $1 $0 times
  268. alias repeatcmd {
  269.     @ RCOUNT = 0
  270.     while (RCOUNT < [$0])
  271.     {
  272.         @ RCOUNT = RCOUNT + 1
  273.         $1-
  274.     }
  275.     ^assign -RCOUNT
  276. }
  277.  
  278. alias nickonly {@ FUNCTION_RETURN = left($index(! $0) $0)}
  279. alias safestr {@ FUNCTION_RETURN = strip(\;\$ $*)}
  280.  
  281. # Returns 1 if you have ops on $0, 0 if you don't.  We use an alias instead
  282. # of ischanop() since ischanop doesn't always return a correct result on
  283. # older clients, and if ischanop were to say that you are not opped when you
  284. # really are, your protection stuff wouldn't go off.
  285. alias gotops {
  286.     @ FUNCTION_RETURN = 0
  287.     if ([$0] == C) {^if (P == [@]) {@ FUNCTION_RETURN = 1}}
  288.     {^if (ischanop($N $0)) {@ FUNCTION_RETURN = 1}}
  289. }
  290.  
  291. # Returns a random letter/number string
  292. @ PP.RC = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789a]
  293. alias randcrap {
  294.     @ RC = 1
  295.     while (RC < [$0])
  296.     {
  297.         @ RC = RC + 1
  298.         @ RS = mid($rand(62) 1 $PP.RC)##RS
  299.     }
  300.     @ RS = mid($rand(25) 1 $PP.RC)##RS
  301.     @ FUNCTION_RETURN = RS
  302.     ^assign -RS
  303.     ^assign -RC
  304. }
  305.  
  306. # Returns true if a string contains letters
  307. alias isalpha {
  308.     if (rmatch($0 *a* *b* *c* *d* *e* *f* *g* *h* *i* *j* *k* *l* *m* *n* *o* *p* *q* *r* *s* *t* *u* *v* *w* *x* *y* *z*)) {@ FUNCTION_RETURN = 1}
  309.     {@ FUNCTION_RETURN = 0}
  310. }
  311.  
  312. # delword <word> <list> (output returned in NLIST)
  313. # recursive alias that deletes a word from a list
  314. alias delword {
  315.     if ([$1] != [$0]) {^assign NLIST $1 $NLIST}
  316.     if ([$2]) {^delword $0 $2-}
  317. }
  318.  
  319. # Check is user is friended/shitted
  320. # ispal/isshit <n!u@h> <#channel>
  321. alias ispal {
  322.     @ FUNCTION_RETURN = 0
  323.     foreach PP.FRIENDS XZ {
  324.         if (match($decode($XZ) $1))
  325.         {
  326.             if (rmatch($0 $PP.FRIENDS[$XZ])) {@ FUNCTION_RETURN = 1}
  327.         }
  328.     }
  329.     ^assign -XZ
  330. }
  331. alias isshit {
  332.     @ FUNCTION_RETURN = 0
  333.     foreach PP.ENEMIES XZ {
  334.         if (match($decode($XZ) $1))
  335.         {
  336.             if (rmatch($0 $PP.ENEMIES[$XZ])) {@ FUNCTION_RETURN = 1}
  337.         }
  338.     }
  339.     ^assign -XZ
  340. }
  341.  
  342. # The pager for long displays, such as in help.
  343. # We do it like this so it doesn't use the old $"-MORE-" method
  344. # which is outdated and causes problems on newer clients.
  345. alias pp.pauseset {
  346.     @ ECCTR = 0
  347.     ^alias echo {
  348.         @ EC[$ECCTR] = [$*]
  349.         @ ECCTR = ECCTR + 1
  350.     }
  351. }
  352. alias pp.pauseend {
  353.     ^alias -echo
  354.     @ ECTR = 0
  355.     ^pp.doechos
  356. }
  357. # Snak adaptation 1.4. Removed check for numlines and "Press ENTER.." input. Snak can scroll...
  358. alias pp.doechos {
  359.     @ LCTR = 0
  360. #    while ((ECTR < ECCTR)&&(LCTR < PP.SET.NUMLINES))
  361.     while (ECTR < ECCTR)
  362.     {
  363.         @ LCTR = LCTR + 1
  364.         echo $EC[$ECTR]
  365.         ^assign -EC[$ECTR]
  366.         @ ECTR = ECTR + 1
  367.     }
  368. #    if ((LCTR >= PP.SET.NUMLINES)&&(ECTR < ECCTR)) {^input "** Press ENTER to continue **" ^pp.doechos}
  369. #    {
  370.         ^assign -LCTR
  371.         ^assign -ECTR
  372.         ^assign -ECCTR
  373.         foreach EC AA {^assign -EC[$AA]}
  374. #    }
  375. }
  376.  
  377. # ----------------------------------------------------------------------------
  378. # Default settings if purepak.sav doesn't exist
  379. # ----------------------------------------------------------------------------
  380.  
  381. # Letters in main settings variable (PP.SET): (this variable is about full)
  382. #   I - Auto-ignore on msg/notice/ctcp floods
  383. #   F - Flood filtering
  384. #   A - Ascii art kicker
  385. #   N - Nick flood protection
  386. #   E - Use enemies list
  387. #   L - Use friends list
  388. #   O - Let everyone know when you are set away
  389. #   G - Log messages and important stuff while away
  390. #   W - Send notices and/or warnings to people
  391. #   J - Auto rejoin on kick
  392. #   M - Mass deop/kick protection
  393. #   K - Channel key flash protection
  394. #   B - Ban protection
  395. #   X - Ignore CTCP PING
  396. #   Y - Ignore CTCP VERSION
  397. #   Z - Ignore CTCP FINGER
  398. #   S - Automatic deop on server ops
  399. #   H - Write awaylog to a file (PP.SET.ALFILE)
  400. #   C - Clonebot mass-join protection
  401. #   Q - Beep on private messages
  402. #   P - Auto-unload help
  403. #   V - Desynched user notification
  404. @ PP.SET = [CGFENLOWJMKBZPV]
  405.  
  406. # Response to mass deop/kick (0 = deop, 1 = kick)
  407. @ PP.SET.MASSRESP = 0
  408. # Auto-ignoring - number of seconds to autoignore
  409. @ PP.SET.IGSECS = 30
  410. # Short kill notice displays
  411. @ PP.SET.SHORTKILLS = 1
  412. # Server notice settings
  413. @ PP.SET.NOTELEVELS = [KUFNMC]
  414. # Nick flood protection sensitivity
  415. @ PP.SET.NFSENS = 3
  416. # Length of the first word in a message for it to be a junkflood
  417. @ PP.SET.JFLEN = 200
  418. # Away log file
  419. @ PP.SET.ALFILE = [away.log]
  420. # Exec commands to do various things
  421. @ PP.SET.FINGERCMD = [finger]
  422. @ PP.SET.LSCMD = [ls -l]
  423. @ PP.SET.LSWCMD = [ls -xp]
  424. @ PP.SET.RMCMD = [rm -f]
  425. @ PP.SET.MAILCMD = [mail]
  426. @ PP.SET.UUECMD = [uuencode]
  427. @ PP.SET.CATCMD = [cat]
  428. @ PP.SET.PSCMD = [ps -uxw]
  429. @ PP.SET.KILLCMD = [kill -KILL]
  430. @ PP.SET.UNGZCMD = [gunzip -c]
  431. @ PP.SET.UNZCMD = [uncompress -c]
  432. @ PP.SET.MKNODCMD = [mknod]
  433. @ PP.SET.NSLOOKCMD = [host]
  434. # Counter variable for awaylog
  435. @ PP.AWAYLCTR = 0
  436. # Minutes of idle-time to be set auto-away (0 disables)
  437. @ PP.SET.AUTOAWAY = 0
  438. # Clonebot mass-join sensitivity (number that must join in a 4 second span
  439. @ PP.SET.CPSENS = 3
  440. # NSLOOKUP on join for IP addresses
  441. @ PP.SET.LOOKJOIN = 1
  442. # Counter for clonebot mass-join detector
  443. @ PP.CPCTR = 0
  444. # Number of lines of output before a pause on help, playback, etc.
  445. @ PP.SET.NUMLINES = 22
  446. # Scripts we should auto-load:
  447. # K = Kicks, X = DCC, B = Bots, S = Silly, W = War
  448. @ PP.SET.AUTOLOAD = [XBS]
  449. # This is set to 1 after the first motd is seen
  450. @ PP.SEENMOTD = 0
  451. # Msg/notice formats
  452. @ PP.SET.MRFORMAT = encode([N!U] M)
  453. @ PP.SET.NRFORMAT = encode(-N- M)
  454. @ PP.SET.MSFORMAT = encode(-> [N] M)
  455. @ PP.SET.NSFORMAT = encode(-> -N- M)
  456. # Channel protection
  457. @ PP.SET.CHANPROT = 1
  458. # Show people as they signoff in splits
  459. @ PP.SET.SHOWSPLITTERS = 0
  460. # Suppress startup messages
  461. @ PP.SET.NOSTARTUP = 0
  462. # Insert random ?'s into bans
  463. @ PP.SET.FUNKYBANS = 1
  464. # Beep on netsplits
  465. @ PP.SET.BSP = 1
  466. # Allow CTCP PAGE
  467. @ PP.SET.CTCPPAGE = 1
  468. # Print time every 10 minutes
  469. @ PP.SET.TP = 0
  470. # Nick to match public
  471. @ PP.SET.PMATCH = [.]
  472.  
  473. # Msg/notice format settings to look like other scripts
  474. @ PP.MR.DEFAULT = encode([N!U] M)
  475. @ PP.MS.DEFAULT = encode(-> [N] M)
  476. @ PP.NR.DEFAULT = encode(-N- M)
  477. @ PP.NS.DEFAULT = encode(-> -N- M)
  478. @ PP.MR.IRCII = encode(*N* M)
  479. @ PP.MS.IRCII = encode(-> *N* M)
  480. @ PP.NR.IRCII = encode(-N- M)
  481. @ PP.NS.IRCII = encode(-> -N- M)
  482. @ PP.MR.TEXTBOX = encode(*N* M)
  483. @ PP.MS.TEXTBOX = encode(-> *N* M)
  484. @ PP.NR.TEXTBOX = encode(-N- M)
  485. @ PP.NS.TEXTBOX = encode(-> -N- M)
  486. @ PP.MR.LICE = encode([N!U] M)
  487. @ PP.MS.LICE = encode([*N*] M)
  488. @ PP.NR.LICE = encode(-N!U- M)
  489. @ PP.NS.LICE = encode([-N-] M)
  490. @ PP.MR.PHOENIX = encode([N:U] M)
  491. @ PP.MS.PHOENIX = encode(<-[N]-> M)
  492. @ PP.NR.PHOENIX = encode(-N- M)
  493. @ PP.NS.PHOENIX = encode(-> -N- M)
  494.  
  495. # ----------------------------------------------------------------------------
  496. # /pp alias to set script options
  497. # ----------------------------------------------------------------------------
  498.  
  499. # Other script parts (the pp-*.irc scripts) can add to this array and have
  500. # their settings under /pp
  501. @ PP.SETCHECKS.M = [^pp.set.m]
  502.  
  503. alias pp.set.bstatus {^if ([$0]) {@ FUNCTION_RETURN = [ON ]} {@ FUNCTION_RETURN = [OFF]}}
  504. alias pp.set.tstatus {^if (index($0 $PP.SET) >= 0) {@ FUNCTION_RETURN = [ON ]} {@ FUNCTION_RETURN = [OFF]}}
  505. alias pp.set.changetoggle {
  506.     if ([$1])
  507.     {
  508.         if ([$1] == [OFF]) {@ PP.SET = strip($0 $PP.SET)}
  509.         {^if (index($0 $PP.SET) < 0) {@ PP.SET = [$0]##PP.SET}}
  510.     }
  511. }
  512. # Snak adaptation 1.4. Snak already handles this
  513. alias pp.set.setupctcp {
  514. #    if (index(X $PP.SET) < 0) {^on raw_irc - "% PRIVMSG % :**PING**"} {^on ^raw_irc "% PRIVMSG % :**PING**" {}}
  515. #    if (index(Y $PP.SET) < 0) {^on raw_irc - "% PRIVMSG % :**VER**"} {^on ^raw_irc "% PRIVMSG % :**VER**" {}}
  516. #    if (index(Z $PP.SET) < 0) {^on raw_irc - "% PRIVMSG % :**FINGER**"} {^on ^raw_irc "% PRIVMSG % :**FINGER**" {}}
  517. }
  518. alias pp.set.onoff {^if ([$0]) {@ FUNCTION_RETURN = [ON]} {@ FUNCTION_RETURN = [OFF]}}
  519.  
  520. alias status {
  521.     ^pp.pauseset
  522.     echo -- Current PurePak settings:
  523.     echo -- ===========================================================================
  524.     echo -- Automatic flood ignoring (AIGnore)                      : $pp.set.tstatus(I)
  525.     echo -- Filtering of known floods (FFILTer)                     : $pp.set.tstatus(F)
  526.     echo -- ASCII art kicker (ARTKick)                              : $pp.set.tstatus(A)
  527.     echo -- Kicking on kick flood (NFProt)                          : $pp.set.tstatus(N)
  528.     echo -- Use of enemies list (ENEMies)                           : $pp.set.tstatus(E)
  529.     echo -- Use of friends list (FRIends)                           : $pp.set.tstatus(L)
  530.     echo -- Public announcement of away status (AWAYNotices)        : $pp.set.tstatus(O)
  531.     echo -- Logging of msgs/events while away (AWAYLogging)         : $pp.set.tstatus(G)
  532.     echo -- Logging to an away log file (AWAYWriting)               : $pp.set.tstatus(H)
  533.     echo -- Name of away log file (AFILE)                           : ${PP.SET.ALFILE}
  534.     echo -- General miscellaneous warnings/notices (NOTIces)        : $pp.set.tstatus(W)
  535.     echo -- Automatic rejoining on kick (KREJoin)                   : $pp.set.tstatus(J)
  536.     echo -- Mass deop/kick protection (MASSProt)                    : $pp.set.tstatus(M)
  537.     if (PP.SET.MASSRESP) {
  538.     echo -- Action taken on mass deop/kick (MASSAction)             : KICK
  539.     } {
  540.     echo -- Action taken on mass deop/kick (MASSAction)             : DEOP
  541.     }
  542.     echo -- Channel protection (CHANprot)                           : $pp.set.onoff($PP.SET.CHANPROT)
  543.     echo -- Automatic removal of server ops (SERVOP)                : $pp.set.tstatus(S)
  544.     echo -- Channel key flash protection (KEYProt)                  : $pp.set.tstatus(K)
  545.     echo -- Ban defense (BANDefense)                                : $pp.set.tstatus(B)
  546.     echo -- Ignoring of CTCP PINGs (PING)                           : $pp.set.tstatus(X)
  547.     echo -- Ignoring of CTCP FINGERs (FINGer)                       : $pp.set.tstatus(Z)
  548.     echo -- Ignoring of CTCP VERSIONs (VERsion)                     : $pp.set.tstatus(Y)
  549.     echo -- Seconds to auto-ignore flooders (IGTime)                : ${PP.SET.IGSECS}
  550.     echo -- Nick flood protection sensitivity (NFSens)              : ${PP.SET.NFSENS}
  551.     echo -- Length of first word for a msg to be junkflood (JFLEN)  : ${PP.SET.JFLEN}
  552.     echo -- Desynched user notification (DESynchnote)               : $pp.set.tstatus(V)
  553.     echo -- Beeping on private messages (MSGBeep)                   : $pp.set.tstatus(Q)
  554.     if (PP.SET.AUTOAWAY) {
  555.     echo -- Minutes of idle time before being set away (AUTOAway)   : ${PP.SET.AUTOAWAY}
  556.     } {
  557.     echo -- Minutes of idle time before being set away (AUTOAway)   : OFF
  558.     }
  559.     echo -- NS lookup of IP adresses on join                        : $pp.set.onoff($PP.SET.LOOKJOIN)
  560.     echo -- Clonebot mass-join protection (CLONEProt)               : $pp.set.tstatus(C)
  561.     echo -- Clonebot mass-join protection sensitivity (CLONESens)   : ${PP.SET.CPSENS}
  562.     if (suppress_server_motd == [ON])
  563.     {
  564.     echo -- Server motd display at startup (MOTD)                   : OFF
  565.     } {
  566.     echo -- Server motd display at startup (MOTD)                   : ON
  567.     }
  568.     echo -- Show users who join/signoff in splits (SHOWSPLITters)   : $pp.set.onoff($PP.SET.SHOWSPLITTERS)
  569.     echo -- Number of rows on this display (ROWS)                   : ${PP.SET.NUMLINES + 2}
  570.     echo -- Auto-loading of pp-bots.irc (LOADBots)                  : $pp.set.sload(B)
  571.     echo -- Auto-loading of pp-xdcc.irc (LOADXdcc)                  : $pp.set.sload(X)
  572.     echo -- Auto-loading of pp-silly.irc (LOADSilly)                : $pp.set.sload(S)
  573.     echo -- Auto-loading of pp-war.irc (LOADWar)                    : $pp.set.sload(W)
  574.     echo -- Auto-loading of pp-kicks.irc (LOADKicks)                : $pp.set.sload(K)
  575.     echo -- Suppression of script startup screens                   : $pp.set.onoff($PP.SET.NOSTARTUP)
  576.     echo -- Insert random ?'s into bans (FUNkybans)                 : $pp.set.onoff($PP.SET.FUNKYBANS)
  577.     echo -- Beep on netsplits (BEEPSPLIT)                           : $pp.set.onoff($PP.SET.BSP)
  578.     echo -- CTCP PAGE (PAGE)                                        : $pp.set.onoff($PP.SET.CTCPPAGE)
  579.     echo -- Print time every 10 minutes (TPRINT)                    : $pp.set.onoff($PP.SET.TP)
  580.     echo -- String to match and highlight in public (PMATCH)        : ${PP.SET.PMATCH}
  581.     echo -- ===========================================================================
  582.     ^pp.pauseend
  583. }
  584.  
  585. alias pp.set.sload {
  586.     if ([$1])
  587.     {
  588.         if ([$1] == [ON])
  589.         {
  590.             if (index($0 $PP.SET.AUTOLOAD) < 0) {@ PP.SET.AUTOLOAD = PP.SET.AUTOLOAD##[$0]}
  591.             pp.autoload
  592.         } {@ PP.SET.AUTOLOAD = strip($0 $PP.SET.AUTOLOAD)}
  593.     } {^if (index($0 $PP.SET.AUTOLOAD) >= 0) {@ FUNCTION_RETURN = [ON]} {@ FUNCTION_RETURN = [OFF]}}
  594. }
  595. alias pp.autoload {
  596.     if ((index(K $PP.SET.AUTOLOAD) >= 0)&&(!(PP.KICKS))) {/load pp-kicks.irc}
  597.     if ((index(B $PP.SET.AUTOLOAD) >= 0)&&(!(PP.BOTS))) {/load pp-bots.irc}
  598.     if ((index(S $PP.SET.AUTOLOAD) >= 0)&&(!(PP.SILLY))) {/load pp-silly.irc}
  599.     if ((index(X $PP.SET.AUTOLOAD) >= 0)&&(!(PP.DCC))) {/load pp-dcc.irc}
  600.     if ((index(W $PP.SET.AUTOLOAD) >= 0)&&(!(PP.WAR))) {/load pp-war.irc}
  601. }
  602.  
  603. alias pp.set.setmformat {
  604.     echo *** Special characters in msg/notice outgoing display formats:
  605.     echo ***   N = Nickname of person you are sending to
  606.     echo ***   M = Text of the message you are sending
  607.     echo ***   T = Current time
  608.     echo *** Special characters in msg/notice incoming display formats:
  609.     echo ***   N = Nickname of the person who sent the msg/notice
  610.     echo ***   U = User@host of sender
  611.     echo ***   M = Text of message
  612.     echo ***   T = Current time
  613.     echo *** ^V,^B,^O,^_ control characters can also be used
  614.     echo ***
  615.     echo *** You may enter new formats for any of these, or press enter for no
  616.     echo *** change.
  617.     echo ***
  618.     echo *** Current incoming message format is: $decode($PP.SET.MRFORMAT)
  619.     ^input "New incoming message format or enter for no change >>" if (1) {
  620.         if ([$0]) {@ PP.SET.MRFORMAT = encode($*)}
  621.         echo *** Current outgoing message format is: $decode($PP.SET.MSFORMAT)
  622.         ^input "New outgoing message format or enter for no change >>" if (1) {
  623.             if ([$0]) {@ PP.SET.MSFORMAT = encode($*)}
  624.             echo *** Current incoming notice format is: $decode($PP.SET.NRFORMAT)
  625.             ^input "New incoming notice format or enter for no chaange >>" if (1) {
  626.                 if ([$0]) {@ PP.SET.NRFORMAT = encode($*)}
  627.                 echo *** Current outgoing notice format is: $decode($PP.SET.NSFORMAT)
  628.                 ^input "New outgoing notice format or enter for no change >>" if (1) {
  629.                     if ([$0]) {@ PP.SET.NSFORMAT = encode($*)}
  630.                     echo ***
  631.                     echo *** Message formats are now set to:
  632.                     echo *** Incoming message: $decode($PP.SET.MRFORMAT)
  633.                     echo *** Outgoing message: $decode($PP.SET.MSFORMAT)
  634.                     echo *** Incoming notice: $decode($PP.SET.NRFORMAT)
  635.                     echo *** Outgoing notice: $decode($PP.SET.NSFORMAT)
  636.                     echo ***
  637.                     echo *** If you have made changes, you must save with /sve for your changes
  638.                     echo *** to become permanent.
  639.                 }
  640.             }
  641.         }
  642.     }
  643. }
  644.  
  645. # *** Main script settings:
  646. # AIGnore = Automatic flood ignoring
  647. # FFILTer = Filtering of known floods
  648. # ARTKick = ASCII art kicker
  649. # NFProt = Kicking on nick flood
  650. # ENEMies = Use of enemies list
  651. # FRIends = Use of friends list
  652. # AWAYNotices = Public announcement of away status
  653. # AWAYLogging = Logging of msgs/events while away
  654. # AWAYWriting = Logging to an away log file
  655. # AFILE = Name of away log file
  656. # NOTIces = General warnings/notices
  657. # KREJoin = Automatic rejoining on kick
  658. # MASSProt = Mass deop/kick protection
  659. # MASSAction = Action taken on mass deop/kick
  660. # SERVOP = Automatic removal of server ops
  661. # KEYProt = Channel key flash protection
  662. # BANDefense = Ban defense
  663. # PING = Ignoring of CTCP PING
  664. # FINGer = Ignoring of CTCP FINGER
  665. # VERsion = Ignoring of CTCP VERSION
  666. # IGTime = Seconds to auto-ignore flooders
  667. # NFSens = Sensitivity of nick flood protection (higher values more sensitive)
  668. # JFLEN = First word length for a message to be a junkflood
  669. # *CMD = Correspond with PP.SET.*CMD above
  670. # MSGBeep = Beep on private messages
  671. # AUTOAway = Minutes of idle-time to be automaticly set away
  672. # CLONEProt = Clonebot mass-join protection
  673. # CLONESens = Sensitivity of clonebot mass-join protection (lower values more sensitive)
  674. # ROWS = Number of rows on display
  675. # LOADBots = Auto load pp-bots.irc
  676. # LOADWar = Auto load pp-war.irc
  677. # LOADSilly = Auto load pp-silly.irc
  678. # LOADKicks = Auto load pp-kicks.irc
  679. # LOADDcc = Auto load pp-dcc.irc
  680. # HELPUnload = Auto unloading of help
  681. # DESynchnote = Desynched user notification
  682. # WRITEMETHOD = /sve write method
  683. # MOTD = Server motd display at startup
  684. # MFORMAT = Msg/notice format settings
  685. # CHANprot = Channel protection
  686. # SHOWSPLITters = Show users who join/signoff in splits
  687. # LOOKJoin = NS lookup of IP adresses on join
  688. # NOSTARTUP = Suppression of startup screens
  689. # FUNkybans = Insert random ?'s into bans
  690. # BEEPSPLIT = Beep on netsplits
  691. # PAGE = CTCP PAGE
  692. # TPRINT = Print time every 10 minutes
  693. # PMATCH = String to match and highlight publicly
  694. alias pp.set.m {
  695.     if (rmatch($0 LOADK* LOADB* LOADW* LOADS* LOADD*))
  696.     {
  697.         if (match($1 ON OFF))
  698.         {
  699.             if (match(LOADB* $0)) {/pp.set.sload B $1}
  700.             if (match(LOADW* $0)) {/pp.set.sload W $1}
  701.             if (match(LOADS* $0)) {/pp.set.sload S $1}
  702.             if (match(LOADK* $0)) {/pp.set.sload K $1}
  703.             if (match(LOADD* $0)) {/pp.set.sload X $1}
  704.         }
  705.         if (match(LOADB* $0)) {/echo *** Auto-loading of pp-bots.irc is now $pp.set.sload(B)}
  706.         if (match(LOADW* $0)) {/echo *** Auto-loading of pp-war.irc is now $pp.set.sload(W)}
  707.         if (match(LOADS* $0)) {/echo *** Auto-loading of pp-silly.irc is now $pp.set.sload(S)}
  708.         if (match(LOADK* $0)) {/echo *** Auto-loading of pp-kicks.irc is now $pp.set.sload(K)}
  709.         if (match(LOADD* $0)) {/echo *** Auto-loading of pp-dcc.irc is now $pp.set.sload(X)}
  710.         @ VU = 1
  711.     }
  712.     if ([$0] == [PAGE])
  713.     {
  714.         if (match($1 ON OFF))
  715.         {
  716.             if ([$1] == [ON]) {@ PP.SET.CTCPPAGE = 1} {@ PP.SET.CTCPPAGE = 0}
  717.         }
  718.         echo *** CTCP PAGE response is now $pp.set.onoff($PP.SET.CTCPPAGE)
  719.         @ VU = 1
  720.     }
  721.     if ([$0] == [TPRINT])
  722.     {
  723.         if (match($1 ON OFF))
  724.         {
  725.             if ([$1] == [ON]) {@ PP.SET.TP = 1} {@ PP.SET.TP = 0}
  726.         }
  727.         echo *** Print time every 10 minutes is now $pp.set.onoff($PP.SET.TP)
  728.         @ VU = 1
  729.     }
  730.     if ([$0] == [BEEPSPLIT])
  731.     {
  732.         if (match($1 ON OFF))
  733.         {
  734.             if ([$1] == [ON]) {@ PP.SET.BSP = 1} {@ PP.SET.BSP = 0}
  735.         }
  736.         echo *** Beep on netsplits is now $pp.set.onoff($PP.SET.BSP)
  737.         @ VU = 1
  738.     }
  739.     if (match(LOOKJ* $0))
  740.     {
  741.         if (match($1 ON OFF))
  742.         {
  743.             if ([$1] == [ON]) {@ PP.SET.LOOKJOIN = 1} {@ PP.SET.LOOKJOIN = 0}
  744.         }
  745.         echo *** NS lookup of IP adresses on join is now $pp.set.onoff($PP.SET.LOOKJOIN)
  746.         @ VU = 1
  747.     }
  748.     if ([$0] == [NOSTARTUP])
  749.     {
  750.         if (match($1 ON OFF))
  751.         {
  752.             if ([$1] == [ON]) {@ PP.SET.NOSTARTUP = 1} {@ PP.SET.NOSTARTUP = 0}
  753.         }
  754.         echo *** Suppression of script startup screens is now $pp.set.onoff($PP.SET.NOSTARTUP)
  755.         @ VU = 1
  756.     }
  757.     if (match(FUN* $0))
  758.     {
  759.         if (match($1 ON OFF))
  760.         {
  761.             if ([$1] == [ON]) {@ PP.SET.FUNKYBANS = 1} {@ PP.SET.FUNKYBANS = 0}
  762.         }
  763.         echo *** Insert random ?'s into bans is now $pp.set.onoff($PP.SET.FUNKYBANS)
  764.         @ VU = 1
  765.     }
  766.     if (match(SHOWSPLIT* $0))
  767.     {
  768.         if (match($1 ON OFF))
  769.         {
  770.             if ([$1] == [ON]) {@ PP.SET.SHOWSPLITTERS = 1} {@ PP.SET.SHOWSPLITTERS = 0}
  771.         }
  772.         echo *** Showing of users who join/signoff in netsplits is now $pp.set.onoff($PP.SET.SHOWSPLITTERS)
  773.         @ VU = 1
  774.     }
  775.     if ([$0] == [MFORMAT])
  776.     {
  777.         @ VU = 1
  778.         if ([$1])
  779.         {
  780.             if (match($1 IRCII TEXTBOX PHOENIX LICE DEFAULT))
  781.             {
  782.                 @ PP.SET.MRFORMAT = PP.MR[$1]
  783.                 @ PP.SET.NRFORMAT = PP.NR[$1]
  784.                 @ PP.SET.MSFORMAT = PP.MS[$1]
  785.                 @ PP.SET.NSFORMAT = PP.NS[$1]
  786.                 echo *** Your msgs/notices now look like: $toupper($1)
  787.             } {/echo *** /pp mformat [<ircii/textbox/phoenix/lice>]}
  788.         } {^pp.set.setmformat}
  789.     }
  790.     if (match(CHAN* $0))
  791.     {
  792.         if (match($1 ON OFF))
  793.         {
  794.             if ([$1] == [ON]) {@ PP.SET.CHANPROT = 1} {@ PP.SET.CHANPROT = 0}
  795.         }
  796.         echo *** Channel protection is now $pp.set.onoff($PP.SET.CHANPROT)
  797.         @ VU = 1
  798.     }
  799.     if (match(DES* $0))
  800.     {
  801.         ^pp.set.changetoggle V $1
  802.         echo *** Desynched user notification is now $pp.set.tstatus(V)
  803.         @ VU = 1
  804.     }
  805.     if (match(AIG* $0))
  806.     {
  807.         ^pp.set.changetoggle I $1
  808.         echo *** Auto-ignoring on msg/notice/ctcp/nick floods is now $pp.set.tstatus(I)
  809.         @ VU = 1
  810.     }
  811.     if ([$0] == [MOTD])
  812.     {
  813.         if (match($1 ON OFF))
  814.         {
  815.             if ([$1] == [ON]) {^set suppress_server_motd OFF} {^set suppress_server_motd ON}
  816.         }
  817.         if (suppress_server_motd == [ON]) {/echo *** Server motd display at startup is now OFF}
  818.         {/echo *** Server motd display at startup is now ON}
  819.         @ VU = 1
  820.     }
  821.     if (match(FFILT* $0))
  822.     {
  823.         ^pp.set.changetoggle F $1
  824.         echo *** Filtering of known floods in msgs/notices/public messages is now $pp.set.tstatus(F)
  825.         @ VU = 1
  826.     }
  827.     if (match(ARTK* $0))
  828.     {
  829.         ^pp.set.changetoggle A $1
  830.         echo *** ASCII art kicker is now $pp.set.tstatus(A)
  831.         @ VU = 1
  832.     }
  833.     if (match(HELPU* $0))
  834.     {
  835.         ^pp.set.changetoggle P $1
  836.         echo *** Automatic unloading of help information is now $pp.set.tstatus(P)
  837.         @ VU = 1
  838.     }
  839.     if (match(NFP* $0))
  840.     {
  841.         ^pp.set.changetoggle N $1
  842.         echo *** Kicking on nick flood is now $pp.set.tstatus(N)
  843.         @ VU = 1
  844.     }
  845.     if (match(ENEM* $0))
  846.     {
  847.         ^pp.set.changetoggle E $1
  848.         echo *** Checking/use of enemies list is now $pp.set.tstatus(E)
  849.         @ VU = 1
  850.     }
  851.     if (match(FRI* $0))
  852.     {
  853.         ^pp.set.changetoggle L $1
  854.         echo *** Checking/use of friends list is now $pp.set.tstatus(L)
  855.         @ VU = 1
  856.     }
  857.     if (match(AWAYN* $0))
  858.     {
  859.         ^pp.set.changetoggle O $1
  860.         echo *** Public announcement of away status is now $pp.set.tstatus(O)
  861.         @ VU = 1
  862.     }
  863.     if (match(AWAYL* $0))
  864.     {
  865.         ^pp.set.changetoggle G $1
  866.         echo *** Logging of messages and important events while away is now $pp.set.tstatus(G)
  867.         @ VU = 1
  868.     }
  869.     if (match(NOTI* $0))
  870.     {
  871.         ^pp.set.changetoggle W $1
  872.         echo *** Sending of general warnings/notices is now $pp.set.tstatus(W)
  873.         @ VU = 1
  874.     }
  875.     if (match(KREJ* $0))
  876.     {
  877.         ^pp.set.changetoggle J $1
  878.         echo *** Automatic rejoining on kick is now $pp.set.tstatus(J)
  879.         @ VU = 1
  880.     }
  881.     if (match(MASSP* $0))
  882.     {
  883.         ^pp.set.changetoggle M $1
  884.         echo *** Mass deop/kick protection is now $pp.set.tstatus(M)
  885.         @ VU = 1
  886.     }
  887.     if (match(MASSA* $0))
  888.     {
  889.         if (match($1 KICK DEOP))
  890.         {
  891.             if ([$1] == [KICK]) {@ PP.SET.MASSRESP = 1} {@ PP.SET.MASSRESP = 0}
  892.         }
  893.         if (PP.SET.MASSRESP) {/echo *** Action taken on mass deop/kick is now KICK}
  894.         {/echo *** Action taken on mass deop/kick is now DEOP}
  895.         @ VU = 1
  896.     }
  897.     if (match(KEYP* $0))
  898.     {
  899.         ^pp.set.changetoggle K $1
  900.         echo *** Channel key flash protection is now $pp.set.tstatus(K)
  901.         @ VU = 1
  902.     }
  903.     if (([$0] == [SERVOP])||([$0] == [NHP]))
  904.     {
  905.         ^pp.set.changetoggle S $1
  906.         echo *** Automatic removal of server ops is now $pp.set.tstatus(S)
  907.         @ VU = 1
  908.     }
  909.     if (match(CLONEP* $0))
  910.     {
  911.         ^pp.set.changetoggle C $1
  912.         echo *** Clonebot mass-join protection is now $pp.set.tstatus(C)
  913.         @ VU = 1
  914.     }
  915.     if (match(BAND* $0))
  916.     {
  917.         ^pp.set.changetoggle B $1
  918.         echo *** Ban defense is now $pp.set.tstatus(B)
  919.         @ VU = 1
  920.     }
  921.     if ([$0] == [PING])
  922.     {
  923.         ^pp.set.changetoggle X $1
  924.         echo *** Ignoring of CTCP PINGs is now $pp.set.tstatus(X)
  925.         @ VU = 1
  926.         ^pp.set.setupctcp
  927.     }
  928.     if (match(FING* $0))
  929.     {
  930.         ^pp.set.changetoggle Z $1
  931.         echo *** Ignoring of CTCP FINGERs is now $pp.set.tstatus(Z)
  932.         @ VU = 1
  933.         ^pp.set.setupctcp
  934.     }
  935.     if (match(VER* $0))
  936.     {
  937.         ^pp.set.changetoggle Y $1
  938.         echo *** Ignoring of CTCP VERSIONs is now $pp.set.tstatus(Y)
  939.         @ VU = 1
  940.         ^pp.set.setupctcp
  941.     }
  942. # Snak adaptation 1.3 Snak has integrated highlighting
  943. #    if ([$0] == [PMATCH])
  944. #    {
  945. #        if ([$1])
  946. #        {
  947. #            if ((PP.SET.PMATCH == [.])&&([$1] != [.])) {^pp.snm $strip(_-[] $N) $1}
  948. #            if ((PP.SET.PMATCH != [.])&&([$1] == [.])) {^pp.snm $PP.SET.PMATCH $strip(_-[] $N)}
  949. #            @ PP.SET.PMATCH = [$1]
  950. #        }
  951. #        echo *** String to match and highlight in public now set to ${PP.SET.PMATCH}
  952. #        @ VU = 1
  953. #    }
  954.     if (match(IGT* $0))
  955.     {
  956.         if ([$1]) {
  957.             if (!isalpha($1)) {@ PP.SET.IGSECS = [$1]}
  958.             {/echo *** Must be a number (recommended value: 10-60)}
  959.         }
  960.         echo *** Number of seconds to auto-ignore flooders is now: ${PP.SET.IGSECS}
  961.         @ VU = 1
  962.     }
  963.     if (match(NFS* $0))
  964.     {
  965.         if ([$1]) {
  966.             if (!isalpha($1)) {@ PP.SET.NFSENS = [$1]}
  967.             {/echo *** Must be a number (recommended value: 3)}
  968.         }
  969.         echo *** Nick flood protection sensitivity is now: ${PP.SET.NFSENS}
  970.         if (PP.SET.NFSENS > 3) {/echo *** Warning: a setting of ${PP.SET.NFSENS} is very sensitive! (higher values more sensitive)}
  971.         @ VU = 1
  972.     }
  973.     if ([$0] == [ROWS])
  974.     {
  975.         if ([$1]) {
  976.             if (!isalpha($1)) {@ PP.SET.NUMLINES = [$1] - 2}
  977.             {/echo *** Must be a number}
  978.         }
  979.         echo *** Number of rows on this display is now: ${PP.SET.NUMLINES + 2}
  980.         @ VU = 1
  981.     }
  982.     if (match(CLONES* $0))
  983.     {
  984.         if ([$1]) {
  985.             if (!isalpha($1)) {@ PP.SET.CPSENS = [$1]}
  986.             {/echo *** Must be a number (recommended value: 3-5)}
  987.         }
  988.         echo *** Clonebot mass-join protection sensitivity is now: ${PP.SET.CPSENS}
  989.         if (PP.SET.CPSENS < 3) {/echo *** Warning: a setting of ${PP.SET.CPSENS} is very sensitive! (lower values more sensitive)}
  990.         @ VU = 1
  991.     }
  992.     if ([$0] == [JFLEN])
  993.     {
  994.         if ([$1]) {
  995.             if (!isalpha($1)) {@ PP.SET.JFLEN = [$1]}
  996.             {/echo *** Must be a number (recommended value: 200)}
  997.         }
  998.         echo *** First word length for a message to be a junkflood is now: ${PP.SET.JFLEN}
  999.         @ VU = 1
  1000.     }
  1001.     if (match(AUTOA* $0))
  1002.     {
  1003.         if ([$1]) {
  1004.             if (!isalpha($1)) {@ PP.SET.AUTOAWAY = [$1]}
  1005.             {
  1006.                 if ([$1] == [OFF]) {@ PP.SET.AUTOAWAY = 0} {/echo *** Must be a number or 'off' to turn off.}
  1007.             }
  1008.         }
  1009.         echo *** Minutes of idle-time before being set away (0=auto-away disabled): ${PP.SET.AUTOAWAY}
  1010.         @ VU = 1
  1011.     }
  1012.     if (match(*CMD $0))
  1013.     {
  1014.         foreach PP.SET AA {
  1015.             if ([$AA] == [$0])
  1016.             {
  1017.                 if ([$1]) {@ PP.SET[$AA] = [$1-]}
  1018.                 echo *** $AA is now [${PP.SET[$AA]}]
  1019.                 @ VU = 1
  1020.             }
  1021.         }
  1022.     }
  1023.     if (match(MSGB* $0))
  1024.     {
  1025.         if (match($1 ON OFF))
  1026.         {
  1027.             ^pp.set.changetoggle Q $1
  1028.             if ([$1] == [ON]) {^set beep_on_msg MSG}
  1029.             {^set beep_on_msg NONE}
  1030.         }
  1031.         echo *** Beeping on private messages is now $pp.set.tstatus(Q)
  1032.         @ VU = 1
  1033.     }
  1034.     if (match(LOGF* $0))
  1035.     {
  1036.         if ([$1]) {^set logfile $1}
  1037.         echo *** IRC logging is now sent to file ${LOGFILE}
  1038.         @ VU = 1
  1039.     }
  1040.     if ([$0] == [LOG])
  1041.     {
  1042.         if (match($1 ON OFF)) {^if ([$1] == [ON]) {^set log on} {^set log off}}
  1043.         echo *** Logging to $LOGFILE is now ${LOG}
  1044.         @ VU = 1
  1045.     }
  1046.     if (match(AWAYW* $0))
  1047.     {
  1048.         ^pp.set.changetoggle H $1
  1049.         echo *** Away log writing to $PP.SET.ALFILE is now $pp.set.tstatus(H)
  1050.         @ VU = 1
  1051.     }
  1052.     if ([$0] == [AFILE])
  1053.     {
  1054.         if ([$1]) {@ PP.SET.ALFILE = [$1]}
  1055.         echo *** Away log file is now ${PP.SET.ALFILE}
  1056.         @ VU = 1
  1057.     }
  1058. }
  1059.  
  1060. alias pp {
  1061.     if ([$0])
  1062.     {
  1063.         @ VU = 0
  1064.         foreach PP.SETCHECKS AA {^if (!VU) {$PP.SETCHECKS[$AA] $*}}
  1065.         if (!VU) {/echo *** No such variable: $0}
  1066.         ^assign -VU
  1067.     } {/echo *** /pp <variable> [<new setting>] (If new setting is left out, current setting is shown)}
  1068. }
  1069.  
  1070. # ----------------------------------------------------------------------------
  1071. # Command abbreviations
  1072. # ----------------------------------------------------------------------------
  1073.  
  1074. alias w {/who $*}
  1075. alias m {/msg $*}
  1076. alias t {/topic $*}
  1077. alias c {/mode $*}
  1078. alias l {
  1079.     leave $0
  1080.     if ([$1]) {/l $1-}
  1081. }
  1082. alias j {
  1083.     if (ischannel($1)) {/join $0} {/join $0 $1}
  1084.     if (ischannel($1)) {/j $1-}
  1085.     if (ischannel($2)) {/j $2-}
  1086. }
  1087. alias , {/whois $*}
  1088. alias wi {/whois $*}
  1089. alias ww {/whowas $*}
  1090. alias n {/nick $*}
  1091. alias k {/kick $*}
  1092. alias o {/op $*}
  1093. alias d {/deop $*}
  1094.  
  1095. alias scan {/names $*}
  1096.  
  1097. # ----------------------------------------------------------------------------
  1098. # Basic channel op command aliases
  1099. # ----------------------------------------------------------------------------
  1100.  
  1101. # Here's all the recursive list processing aliases for the mass commands
  1102. # pp.listm.<# at once> <mode> <#channel> <users>
  1103. alias pp.listm.1 {
  1104.     //mode $1 $0 $2
  1105.     if ([$3]) {^pp.listm.1 $0 $1 $3-}
  1106. }
  1107. alias pp.listm.2 {
  1108.     //mode $1 $0 $2 $3
  1109.     if ([$4]) {^pp.listm.2 $0 $1 $4-}
  1110. }
  1111. alias pp.listm.3 {
  1112.     //mode $1 $0 $2 $3 $4
  1113.     if ([$5]) {^pp.listm.3 $0 $1 $5-}
  1114. }
  1115. alias pp.listm.4 {
  1116.     //mode $1 $0 $2 $3 $4 $5
  1117.     if ([$6]) {^pp.listm.4 $0 $1 $6-}
  1118. }
  1119. # pp.listk <#channel> <nicks> ($KREASON contains reason for kicks)
  1120. alias pp.listk {
  1121.     //kick $0 $1 $KREASON
  1122.     if ([$2]) {^pp.listk $0 $2-}
  1123. }
  1124. # pp.listdcc <file> <nicks>
  1125. alias pp.listdcc {
  1126.     //^dcc send $1 $0
  1127.     if ([$2]) {^pp.listdcc $0 $2-}
  1128. }
  1129. # pp.listmsg <PRIVMSG/NOTICE> <nicks/channels> (SEND_MSG contains message)
  1130. alias pp.listmsg {
  1131.     ^quote $0 $1 :$SEND_MSG
  1132.     if ([$2]) {^pp.listmsg $0 $2-}
  1133. }
  1134. # pp.listunban <#channel> <strings>
  1135. alias pp.listunban {
  1136.     if ([$4])
  1137.     {
  1138.         //mode $0 -bbb $1 $2 $3
  1139.         ^pp.listunban $0 $4-
  1140.     } {^if ([$3]) {//mode $0 -bbb $1 $2 $3} {^if ([$2]) {//mode $0 -bb $1 $2} {^if ([$1]) {//mode $0 -b $1}}}}
  1141. }
  1142.  
  1143. # pp.mdop <#channel> <# at once> <mask>
  1144. # Smart massdeopper: deops the closest people net-wise first.  (Gee, I wonder
  1145. # how many scripts this is gonna appear in?)
  1146. alias pp.mdop {
  1147.     @ HIGHHOPS = 0
  1148.     @ DMASK = [$2]
  1149.     on ^who * {
  1150.         if ((match(*${DMASK}* $1!$3@$4))&&([$1] != N))
  1151.         {
  1152.             if (!match($1 $PP.BOTNICKS))
  1153.             {
  1154.                 if (!PP.EPIC)
  1155.                 {
  1156.                     @ MDOPZ[$5] = MDOPZ[$5]##[ $1]
  1157.                     if ([$5] > HIGHHOPS) {@ HIGHHOPS = [$5]}
  1158.                 }
  1159.                 {
  1160.                     @ MDOPZ[$6] = MDOPZ[$6]##[ $1]
  1161.                     if ([$6] > HIGHHOPS) {@ HIGHHOPS = [$6]}
  1162.                 }
  1163.             }
  1164.         }
  1165.     }
  1166.     //^who -chops $0
  1167.     @ DEOPCNT = [$1]
  1168.     @ DEOPCHAN = [$0]
  1169.     wait -CMD if (1) {
  1170.         if (DEOPCNT <= 1) {@ MCH = [-o]}
  1171.         if (DEOPCNT == 2) {@ MCH = [-oo]}
  1172.         if (DEOPCNT == 3) {@ MCH = [-ooo]}
  1173.         if (DEOPCNT >= 4) {@ MCH = [-oooo]}
  1174.         @ CTR = 0
  1175.         while (CTR <= HIGHHOPS)
  1176.         {
  1177.             @ MDOPZ = MDOPZ##[ $MDOPZ[$CTR]]
  1178.             ^assign -MDOPZ[$CTR]
  1179.             @ CTR = CTR + 1
  1180.         }
  1181.         ^pp.listm.$DEOPCNT $MCH $DEOPCHAN $MDOPZ
  1182.         ^assign -DEOPCNT
  1183.         ^assign -DEOPCHAN
  1184.         ^assign -MCH
  1185.         ^assign -HIGHHOPS
  1186.         ^assign -CTR
  1187.         ^assign -MDOPZ
  1188.         ^assign -DMASK
  1189.         ^on who -
  1190.     }
  1191. }
  1192.  
  1193. # pp.mkick <#channel> <mask> <reason>
  1194. alias pp.mkick {
  1195.     @ KMASK = [$1]
  1196.     ^on ^who * {
  1197.         ^if ((match(*${KMASK}* $1!$3@$4))&&([$1] != N))
  1198.         {
  1199.             ^if (!match($1 $PP.BOTNICKS)) {@ MKZ = [$1 $MKZ]}
  1200.         }
  1201.     }
  1202.     //^who $0
  1203.     @ KCHAN = [$0]
  1204.     @ KREASON = [$2-]
  1205.     wait -CMD if (1) {
  1206.         ^pp.listk $KCHAN $MKZ
  1207.         ^assign -KCHAN
  1208.         ^assign -MKZ
  1209.         ^assign -KMASK
  1210.         ^assign -KREASON
  1211.         ^on who -
  1212.     }
  1213. }
  1214.  
  1215. # pp.mop <#channel> <mask>
  1216. alias pp.mop {
  1217.     @ OPMASK = [$1]
  1218.     ^on ^who * {^if ((!match(*@* $2))&&(match(*${OPMASK}* $1!$3@$4))) {^if ([$1] != N) {@ MOPZ = [$MOPZ $1]}}}
  1219.     //^who $0
  1220.     @ MOPCHAN = [$0]
  1221.     wait -CMD if (1) {
  1222.         ^pp.listm.3 +ooo $MOPCHAN $MOPZ
  1223.         ^assign -MOPCHAN
  1224.         ^assign -MOPZ
  1225.         ^assign -OPMASK
  1226.         ^on ^who -
  1227.     }
  1228. }
  1229.  
  1230. # pp.modev <#channel> <mask> <+/->
  1231. alias pp.modev {
  1232.     @ VMASK = [$1]
  1233.     ^on ^who * {^if (match(*${VMASK}* $1!$3@$4)) {@ MVZ = [$MVZ $1]}}
  1234.     //^who $0
  1235.     @ MVCHAN = [$0]
  1236.     @ MVMODE = [$2]
  1237.     wait -CMD if (1) {
  1238.         ^pp.listm.3 ${MVMODE}vvv $MVCHAN $MVZ
  1239.         ^assign -MVCHAN
  1240.         ^assign -MVMODE
  1241.         ^assign -MVZ
  1242.         ^assign -VMASK
  1243.         ^on ^who -
  1244.     }
  1245. }
  1246.  
  1247. # The user mass commands
  1248. # mdop/mvop/mop/munvop [<mask>]
  1249. alias mdop.1 {^if (gotops($C)) {^if ([$0]) {^pp.mdop $C 1 $0} {^pp.mdop $C 1 *}} {/echo *** You don't have ops on $C}}
  1250. alias mdop.2 {^if (gotops($C)) {^if ([$0]) {^pp.mdop $C 2 $0} {^pp.mdop $C 2 *}} {/echo *** You don't have ops on $C}}
  1251. alias mdop.3 {^if (gotops($C)) {^if ([$0]) {^pp.mdop $C 3 $0} {^pp.mdop $C 3 *}} {/echo *** You don't have ops on $C}}
  1252. alias mdop.4 {^if (gotops($C)) {^if ([$0]) {^pp.mdop $C 4 $0} {^pp.mdop $C 4 *}} {/echo *** You don't have ops on $C}}
  1253. alias mdop {^mdop.4 $*}
  1254. alias mop {^if (gotops($C)) {^if ([$0]) {^pp.mop $C $0} {^pp.mop $C *}} {/echo *** You don't have ops on $C}}
  1255. alias mvop {^if (gotops($C)) {^if ([$0]) {^pp.modev $C $0 +} {^pp.modev $C * +}} {/echo *** You don't have ops on $C}}
  1256. alias munvop {^if (gotops($C)) {^if ([$0]) {^pp.modev $C $0 -} {^pp.modev $C * -}} {/echo *** You don't have ops on $C}}
  1257.  
  1258. # Fast mdop (x4)
  1259. alias fmdop {
  1260.     if (gotops($C))
  1261.     {
  1262.         if (match(*!*@* $0)) {@ UM = [$0]} {@ UM = [*!*@*]}
  1263.         foreach PP.USERS.$encode($tolower($C)) AA {
  1264.             if (decode($AA) != N)
  1265.             {
  1266.                 if ((ischanop($decode($AA) $C))&&(match($UM $decode($AA)!$word(2 $PP.USERS[$encode($tolower($C))][$AA])))) {@ MDOPZ = MDOPZ##[$decode($AA) ]}
  1267.             }
  1268.         }
  1269.         pp.listm.4 -oooo $C $MDOPZ
  1270.         ^assign -MDOPZ
  1271.         ^assign -UM
  1272.     } {/echo *** You don't have ops on $C}
  1273. }
  1274.  
  1275. # op and deop aliases
  1276. # op/deop <nicks>
  1277. alias op {^if ([$0]) {^pp.listm.3 +ooo $C $*} {/echo *** /op <nick> [<nick> ...]}}
  1278. alias deop {^if ([$0]) {^pp.listm.2 -oo $C $*} {/echo *** /deop <nick> [<nick> ...]}}
  1279.  
  1280. # masskick aliases
  1281. # masskick [<reason>] (kicks with mask *)  mkick [<mask>]
  1282. alias masskick {^if (gotops($C)) {^if ([$0]) {^pp.mkick $C * $*} {^pp.mkick $C * [Masskick: *]}} {/echo *** You don't have ops on $C}}
  1283. alias mkick {^if (gotops($C)) {^if ([$0]) {^pp.mkick $C $0 [Masskick: $0]} {^pp.mkick $C * [Masskick: *]}} {/echo *** You don't have ops on $C}}
  1284.  
  1285. # Kicks all non-operators on channel
  1286. alias lkick {
  1287.     if (gotops($C))
  1288.     {
  1289.         ^on ^who * {/if (([$1] != N)&&(!rmatch($2 *@*))) {//kick $0 $1 [Non-Operator Kick]}}
  1290.         //^who *
  1291.         wait -CMD ^on who -
  1292.     } {/echo *** You don't have ops on $C}
  1293. }
  1294.  
  1295. # massdcc <file> [<mask>]
  1296. alias massdcc {
  1297.     if ([$0])
  1298.     {
  1299.         if ([$1]) {@ DCCMASK = [$1]} {@ DCCMASK = [*]}
  1300.         ^on ^who * {^if (([$1] != N)&&(match(*${DCCMASK}* $1!$3@$4))) {@ DCCPPL = [$1 $DCCPPL]}}
  1301.         //^who *
  1302.         @ MDFILE = [$0]
  1303.         wait -CMD if (1) {
  1304.             ^on who -
  1305.             ^pp.listdcc $MDFILE $DCCPPL
  1306.             ^assign -DCCMASK
  1307.             ^assign -DCCPPL
  1308.             echo *** Sent DCC SEND request for $MDFILE to everyone in $C
  1309.             ^assign -MDFILE
  1310.         }
  1311.     } {/echo *** /massdcc <file> [<mask>]}
  1312. }
  1313.  
  1314. # Re-aliased to not require channel names
  1315. alias invite {^if (ischannel($1)) {//invite $*} {//invite $0 $C}}
  1316. alias kick {^if (ischannel($0)) {//kick $*} {//kick $C $0 $1-}}
  1317. alias mode {^if (ischannel($0)) {//mode $*} {^if ([$0] == N) {//mode $*} {//mode $C $*}}}
  1318.  
  1319. # pp.snm old new
  1320. # Snak adaptation 1.3 Snak has integrated highlighting
  1321. #alias pp.snm {
  1322. #    EVAL ^on raw_irc - "% PRIVMSG #% :*$0*"
  1323. #    EVAL ^on ^raw_irc "% PRIVMSG #% :*$1*" {
  1324. #        if (match(*ACTION* $3))
  1325. #        {
  1326. #            if ([$2] == C) {/xecho -window $winnum() -level PUBLIC * $nickonly($0) $strip( $4-)}
  1327. #            {/xecho -window $winnum() -level PUBLIC * $nickonly($0):$2 $strip( $4-)}
  1328. #        }
  1329. #        {
  1330. #            if ([$2] == C) {/xecho -window $winnum() -level PUBLIC <$nickonly($0)> $strip( $mid(1 65535 $3) $4-)}
  1331. #            {/xecho -window $winnum() -level PUBLIC <$nickonly($0):$2> $strip( $mid(1 65535 $3) $4-)}
  1332. #        }
  1333. #    }
  1334. #}
  1335.  
  1336. # Snak adaptation 1.3 Snak has integrated highlighting
  1337. alias nick {
  1338.     ^if ([$0])
  1339.     {
  1340. #        if (PP.SET.PMATCH == [.]) {^pp.snm $strip(_-[] $N) $strip(_-[] $0)}
  1341.         if (PP.DCC) {^dcc.onnick $*}
  1342.         quote NICK $*
  1343.     } {/nick $randcrap(9)}
  1344. }
  1345.  
  1346. # We don't use the -k$M method because of how the mode locking code works
  1347. alias clearmode {
  1348.     if (ischannel($0))
  1349.     {
  1350.         ^on ^324 * {@ CMODE = strip(:+ $2)##[ $3-]}
  1351.         //mode $0
  1352.         @ CMCHAN = [$0]
  1353.         wait -CMD if (1) {
  1354.             ^on 324 -
  1355.             //mode $CMCHAN -k$CMODE
  1356.             ^assign -CMCHAN
  1357.             ^assign -CMODE
  1358.         }
  1359.     } {/clearmode $C}
  1360. }
  1361.  
  1362. # Bans bots and bomb/inverse/beep/etc usernames
  1363. alias botban {//mode $C +bbb *b?t!*@* *srv!*@* *s?rv!*@*}
  1364. alias bot {//bot}
  1365.  
  1366. # pp.clearban <channel> <mask>
  1367. alias pp.clearban {
  1368.     @ BANMASK = [$1]
  1369.     ^on ^raw_irc "% 367 *" {^if ((match(*${BANMASK}* $4))||(match($4 $BANMASK))) {@ CBUNBAND = [$4 $CBUNBAND]}}
  1370.     //mode $0 b
  1371.     wait -CMD if (1) {
  1372.         ^pp.listunban $C $CBUNBAND
  1373.         ^assign -CBUNBAND
  1374.         ^assign -BANMASK
  1375.         ^on raw_irc - "% 367 *"
  1376.     }
  1377. }
  1378.  
  1379. # User clearban alias
  1380. # clearban [<mask>]
  1381. alias clearban {^if ([$0]) {^pp.clearban $C $*} {^pp.clearban $C *}}
  1382.  
  1383. # Unban alias: looks up user's user@host and runs a clearban
  1384. # unban <nick>
  1385. alias unban {
  1386.     if ([$0]) {
  1387.         if (match(*!*@* $0)) {^pp.listunban $C $*}
  1388.         {
  1389.             ^Userhost $0 -CMD if ([$3]) {
  1390.                 if ([$4] != [<UNKNOWN>]) {^pp.clearban $C $0!$3@$4} {/echo *** $0 is not on IRC}
  1391.             }
  1392.         }
  1393.     } {/echo *** /unban <nick/umask>}
  1394. }
  1395.         
  1396. # ban <nick>
  1397. alias ban {
  1398.     if ([$0])
  1399.     {
  1400.         if (match(*!*@* $0)) {//mode $C +bbb $*}
  1401.         {
  1402.             ^Userhost $0 -CMD if ([$3]) {
  1403.                 if ([$4] != [<UNKNOWN>])
  1404.                 {
  1405.                     @ HNAME = [$4]
  1406.                     if ((!isalpha($HNAME))&&(match(*.*.*.* $HNAME))) {@ ST = [*!*$mid(1 1000 $3)@]##left($rindex(. $HNAME) $HNAME)##[.*]}
  1407.                     {@ ST = [*!*$mid(1 1000 $3)@*$right(${@HNAME-index(. $4)} $4)]}
  1408.                     if (PP.SET.FUNKYBANS)
  1409.                     {
  1410.                         @ AA = []
  1411.                         @ CT = 0
  1412.                         while (CT < [$@ST])
  1413.                         {
  1414.                             @ SC = mid($CT 1 $ST)
  1415.                             if ((!match(*${SC}* @!.))&&(SC != [*]))
  1416.                             {
  1417.                                 if (rand(4) == 2) {@ AA = AA##[?]}
  1418.                                 {@ AA = AA##SC}
  1419.                             } {@ AA = AA##SC}
  1420.                             @ CT = CT + 1
  1421.                         }
  1422.                         ^assign -CT
  1423.                         ^assign -SC
  1424.                     } {@ AA = ST}
  1425.                     ^assign -ST
  1426.                     ^assign -HNAME
  1427.                     //mode $C +b $AA
  1428.                 } {/echo *** $0 is not on IRC}
  1429.             }
  1430.         }
  1431.     } {//mode $C b}
  1432. }
  1433.  
  1434. # /wordkick <channel> <word/phrase>
  1435. # or /wordkick <channel> off
  1436. alias wordkick {
  1437.     if ([$1])
  1438.     {
  1439.         if (ischannel($0)) {@ WCHAN = [$0]} {@ WCHAN = [#$0]}
  1440.         if ([$1] == [OFF])
  1441.         {
  1442.             foreach WORDKICKS AA {
  1443.                 if (decode($AA) == [$WCHAN])
  1444.                 {
  1445.                     EVAL ^on raw_irc - "% ??????% $decode($AA) :*$WORDKICKS[$AA]*"
  1446.                     ^assign -WORDKICKS[$AA]
  1447.                     @ WK = 1
  1448.                 }
  1449.             }
  1450.             if (WK) {/echo *** Wordkick for $WCHAN removed} {/echo *** There is no wordkick active on $WCHAN}
  1451.             ^assign -WK
  1452.         }
  1453.         {
  1454.             @ WORDKICKS[$encode($WCHAN)] = [$1-]
  1455.             EVAL ^on -raw_irc "% ??????% $WCHAN :*$1-*" {
  1456.                 //kick $2 $nickonly($0) [Wordkick]
  1457.             }
  1458.             echo *** Wordkick for '$1-' now active on channel $WCHAN
  1459.         }
  1460.         ^assign -WCHAN
  1461.     }
  1462.     {
  1463.         echo *** Active wordkicks:
  1464.         foreach WORDKICKS AA {/echo *** Channel: $[12]decode($AA) Word/phrase: $WORDKICKS[$AA]}
  1465.     }
  1466. }
  1467.  
  1468. # ----------------------------------------------------------------------------
  1469. # Friends and enemies lists handlers
  1470. # ----------------------------------------------------------------------------
  1471.  
  1472. # 'CK' is $encode(*)
  1473.  
  1474. # pp.addl <FRIENDS/ENEMIES> <umask> <channel/*>
  1475. alias pp.addl {
  1476.     if ((!match($1 $PP[$0][$encode($toupper($2))]))&&(!match($1 $PP[$0][CK])))
  1477.     {
  1478.         if (PP[$0][$encode($toupper($2))]) {@ PP[$0][$encode($toupper($2))] = PP[$0][$encode($toupper($2))]##[ $1]} {@ PP[$0][$encode($toupper($2))] = [$1]}
  1479.         if ([$2] == [*]) {/echo *** User mask [$1] added to global $tolower($0) list}
  1480.         {/echo *** User mask [$1] added to $tolower($0) list for channel mask $2}
  1481.     }
  1482.     {
  1483.         if ([$2] == [*]) {/echo *** A user mask matching [$1] is already on your global friends list}
  1484.         {/echo *** A user mask matching [$1] is already on the list for channel mask $2 or the global list}
  1485.     }
  1486. }
  1487. # pp.rml <FRIENDS/ENEMIES> <umask> <channel/*>
  1488. alias pp.rml {
  1489.     if ((match($1 $PP[$0][$encode($toupper($2))]))||(rmatch($1 $PP[$0][$encode($toupper($2))])))
  1490.     {
  1491.         @ CN = encode($toupper($2))
  1492.         @ AA = 0
  1493.         while (word($AA $PP[$0][$CN]))
  1494.         {
  1495.             if ((match($1 $word($AA $PP[$0][$CN])))||(match($word($AA $PP[$0][$CN]) $1)))
  1496.             {
  1497.                 ^delword $word($AA $PP[$0][$CN]) $PP[$0][$CN]
  1498.                 @ PP[$0][$CN] = NLIST
  1499.                 ^assign -NLIST
  1500.                 @ AA = 0
  1501.             } {@ AA = AA + 1}
  1502.         }
  1503.         if (!(word(0 $PP[$0][$CN]))) {^assign -PP[$0][$CN]}
  1504.         ^assign -CN
  1505.         if ([$2] == [*]) {/echo *** All patterns matching [$1] removed from global $tolower($0) list}
  1506.         {/echo *** All patterns matching [$1] removed from list for channel mask $2}
  1507.     }
  1508.     {
  1509.         if ([$2] == [*]) {/echo *** No patterns matching [$1] are on your global friends list}
  1510.         {/echo *** No patterns matching [$1] are on the list for channel mask $2 or the global list}
  1511.     }
  1512. }
  1513. # pp.rmlall <FRIENDS/ENEMIES> <umask>
  1514. alias pp.rmlall {
  1515.     EVAL ^foreach PP.$0 AB {
  1516.         if ((match($1 $PP[$0][$AB]))||(rmatch($1 $PP[$0][$AB]))) {^pp.rml $0 $1 $tolower($decode($AB))}
  1517.     }
  1518. }
  1519.  
  1520. # /friend <nick/umask> [<channel mask>]
  1521. alias friend {
  1522.     if ([$0])
  1523.     {
  1524.         if (match(*!*@* $0)) {^if ([$1]) {/pp.addl FRIENDS $0 $1} {/pp.addl FRIENDS $0 *}}
  1525.         {
  1526.             if ([$1]) {@ AA = [$1]} {@ AA = [*]}
  1527.             ^Userhost $0 -CMD if ([$3]) {
  1528.                 if ([$4] != [<UNKNOWN>])
  1529.                 {
  1530.                     @ UHOST = [$mid(1 $index(@ $3@$4) $mid(${index(! $3@$4)+1} 1000 $3@$4))*$mid(${index(. $3@$4)+1} 1000 $3@$4)]
  1531.                     ^pp.addl FRIENDS *!*$UHOST $AA
  1532.                     ^alias echo {}
  1533.                     ^pp.rml ENEMIES *!*$UHOST $AA
  1534.                     ^alias -echo
  1535.                     ^assign -UHOST
  1536.                     if (index(W $PP.SET) >= 0) {//^notice $0 [PurePak] You have been added to my friends list for channels matching [${AA}]: type /ctcp $N HELP for functions available to you}
  1537.                 } {/echo *** $0 is not on IRC}
  1538.             }
  1539.         }
  1540.     } {/echo *** /friend <nick/umask> [<channel mask>] (can contain wildcards)}
  1541. }
  1542. # /enemy <nick/umask> [<channel mask>]
  1543. alias enemy {
  1544.     if ([$0])
  1545.     {
  1546.         if (match(*!*@* $0)) {^if ([$1]) {/pp.addl ENEMIES $0 $1} {/pp.addl ENEMIES $0 *}}
  1547.         {
  1548.             if ([$1]) {@ AA = [$1]} {@ AA = [*]}
  1549.             ^Userhost $0 -CMD if ([$3]) {
  1550.                 if ([$4] != [<UNKNOWN>])
  1551.                 {
  1552.                     @ UHOST = [$mid(1 $index(@ $3@$4) $mid(${index(! $3@$4)+1} 1000 $3@$4))*$mid(${index(. $3@$4)+1} 1000 $3@$4)]
  1553.                     ^pp.addl ENEMIES *!*$UHOST $AA
  1554.                     ^alias echo {}
  1555.                     ^pp.rml FRIENDS *!*$UHOST $AA
  1556.                     ^alias -echo
  1557.                     ^assign -UHOST
  1558.                 } {/echo *** $0 is not on IRC}
  1559.             }
  1560.         }
  1561.     } {/echo *** /enemy <nick/umask> [<channel mask>] (can contain wildcards)}
  1562. }
  1563.  
  1564. # /rmfriend <nick/umask> [<channel mask>]
  1565. alias rmfriend {
  1566.     if ([$0])
  1567.     {
  1568.         if (match(*!*@* $0)) {^if ([$1]) {/pp.rml FRIENDS $0 $1} {/pp.rmlall FRIENDS $0}}
  1569.         {
  1570.             if ([$1]) {@ AA = [$1]} {@ AA = [AA]}
  1571.             ^Userhost $0 -CMD if ([$3]) {
  1572.                 if ([$4] != [<UNKNOWN>])
  1573.                 {
  1574.                     @ UHOST = [$mid(1 $index(@ $3@$4) $mid(${index(! $3@$4)+1} 1000 $3@$4))*$mid(${index(. $3@$4)+1} 1000 $3@$4)]
  1575.                     if (AA == [AA]) {^pp.rmlall FRIENDS *!*$UHOST} {^pp.rml FRIENDS *!*$UHOST $AA}
  1576.                     ^assign -UHOST
  1577.                 } {/echo *** $0 is not on IRC}
  1578.             }
  1579.         }
  1580.     } {/echo *** /rmfriend <nick/umask> [<channel mask>] (can contain wildcards)}
  1581. }
  1582. # /rmenemy <nick/umask> [<channel mask>]
  1583. alias rmenemy {
  1584.     if ([$0])
  1585.     {
  1586.         if (match(*!*@* $0)) {^if ([$1]) {/pp.rml ENEMIES $0 $1} {/pp.rmlall ENEMIES $0}}
  1587.         {
  1588.             if ([$1]) {@ AA = [$1]} {@ AA = [AA]}
  1589.             ^Userhost $0 -CMD if ([$3]) {
  1590.                 if ([$4] != [<UNKNOWN>])
  1591.                 {
  1592.                     @ UHOST = [$mid(1 $index(@ $3@$4) $mid(${index(! $3@$4)+1} 1000 $3@$4))*$mid(${index(. $3@$4)+1} 1000 $3@$4)]
  1593.                     if (AA == [AA]) {^pp.rmlall ENEMIES *!*$UHOST} {^pp.rml ENEMIES *!*$UHOST $AA}
  1594.                     ^assign -UHOST
  1595.                 } {/echo *** $0 is not on IRC}
  1596.             }
  1597.         }
  1598.     } {/echo *** /rmenemy <nick/umask> [<channel mask>] (can contain wildcards)}
  1599. }
  1600.  
  1601. alias nofriends {/rmfriend *!*@*}
  1602. alias noenemies {/rmenemy *!*@*}
  1603.  
  1604. alias lsfriends {
  1605.     echo *** Channel Mask   Patterns
  1606.     if (PP.FRIENDS.CK) {/echo *** [Global (*)]   $PP.FRIENDS.CK}
  1607.     foreach PP.FRIENDS AA {
  1608.         if (AA != [CK])
  1609.         {
  1610.             @ CM = tolower($decode($AA))
  1611.             echo *** $[14]CM $PP.FRIENDS[$AA]
  1612.         }
  1613.     }
  1614.     ^assign -CM
  1615. }
  1616. alias lsenemies {
  1617.     echo *** Channel Mask   Patterns
  1618.     if (PP.ENEMIES.CK) {/echo *** [Global (*)]   $PP.ENEMIES.CK}
  1619.     foreach PP.ENEMIES AA {
  1620.         if (AA != [CK])
  1621.         {
  1622.             @ CM = tolower($decode($AA))
  1623.             echo *** $[14]CM $PP.ENEMIES[$AA]
  1624.         }
  1625.     }
  1626.     ^assign -CM
  1627. }
  1628.  
  1629. # ----------------------------------------------------------------------------
  1630. # Miscellaneous user aliases
  1631. # ----------------------------------------------------------------------------
  1632.  
  1633. # pp.mmsg <PRIVMSG/NOTICE> <who status match> <msg>
  1634. alias pp.mmsg {
  1635.     @ STATP = [$1]
  1636.     ^on ^who * {^if (([$1] != N)&&(match($STATP $2))) {@ MSGNICKS = [$1 ]##MSGNICKS}}
  1637.     @ SEND_TYPE = [$0]
  1638.     @ SEND_MSG = [$2-]
  1639.     //^who *
  1640.     wait -CMD if (1) {
  1641.         ^on who -
  1642.         ^pp.listmsg $SEND_TYPE $MSGNICKS
  1643.         if (SEND_TYPE == [NOTICE])
  1644.         {
  1645.             @ EC.1 = [-]
  1646.             @ EC.2 = [-]
  1647.         }
  1648.         {
  1649.             @ EC.1 = [[]
  1650.             @ EC.2 = []]
  1651.         }
  1652.         if (STATP == [*@*]) {/echo -> ${EC.1}OPS@$C${EC.2} $SEND_MSG} {/echo -> ${EC.1}*@$C${EC.2} $SEND_MSG}
  1653.         ^assign -EC.1
  1654.         ^assign -EC.2
  1655.         ^assign -SEND_TYPE
  1656.         ^assign -SEND_MSG
  1657.         ^assign -MSGNICKS
  1658.         ^assign -STATP
  1659.     }
  1660. }
  1661.  
  1662. # Mass msg'ing aliases
  1663. alias msgall {^if ([$0]) {^pp.mmsg PRIVMSG * $*} {/echo *** /msgall <msg>}}
  1664. alias msgops {^if ([$0]) {^pp.mmsg PRIVMSG *@* $*} {/echo *** /msgops <msg>}}
  1665. alias wallops {^if ([$0]) {^pp.mmsg NOTICE *@* [WallOps:${C}] $*} {/echo *** /wallops <msg> (Use //wallops to use IRC's original wallops command)}}
  1666. alias wall {/wallops $*}
  1667.  
  1668. # So that help servers won't trigger flood protection
  1669. alias help {
  1670.     EVAL ^on -flood "$help_service *" {}
  1671.     EVAL ^timer 60 ^on flood - "$help_service *"
  1672.     //help $*
  1673. }
  1674.  
  1675. alias finger {
  1676.     if ([$0])
  1677.     {
  1678.         if (match(*@* $0)) {/exec $PP.SET.FINGERCMD $0}            
  1679.         {
  1680.             ^Userhost $0 -CMD if ([$3]) {^if ([$3] != [<UNKNOWN>]) {/exec $PP.SET.FINGERCMD $strip(~ $3)@$4} {/echo *** $0 is not on IRC}}
  1681.         }
  1682.     } {/echo *** /finger <nick> -or- /finger <user@host>}
  1683. }
  1684.  
  1685. # Uncompressing /load command
  1686. on ^exec "uncomp *" {/echo *** Output from uncompress program: $1-}
  1687. alias load {
  1688.     if ([$0])
  1689.     {
  1690.         if (right(3 $0) == [.gz]) {@ COMPRESS.ISCOMP = PP.SET.UNGZCMD}
  1691.         if (right(2 $0) == [.Z]) {@ COMPRESS.ISCOMP = PP.SET.UNZCMD}
  1692.         if (COMPRESS.ISCOMP)
  1693.         {
  1694.             ^set input_prompt [$0] Uncompressing and loading...
  1695.             @ COMPRESS.PIPENAME = [/tmp/pptmp]##rand(99999999)
  1696.             @ CMPFILE = [$0]
  1697.             exec -name mknod $PP.SET.MKNODCMD $COMPRESS.PIPENAME p
  1698.             wait -CMD %mknod if (1) {
  1699.                 exec -name uncomp $COMPRESS.ISCOMP $CMPFILE >>$COMPRESS.PIPENAME
  1700.                 //load $COMPRESS.PIPENAME
  1701.                 exec -name rm $PP.SET.RMCMD $COMPRESS.PIPENAME
  1702.                 ^assign -CMPFILE
  1703.                 ^assign -COMPRESS.PIPENAME
  1704.                 ^assign -COMPRESS.ISCOMP
  1705.                 ^set -input_prompt
  1706.             }
  1707.         }
  1708.         {
  1709.             ^set input_prompt [$0] Loading...
  1710.             //load $*
  1711.             ^set -input_prompt
  1712.         }
  1713.     } {//load}
  1714. }
  1715.  
  1716. alias names {^if ([$0]) {//names $*} {/if (ischannel($C)) {//names $C}}}
  1717. alias chops {^if ([$0]) {/who $0 -chops} {/who $C -chops}}
  1718.  
  1719. alias bk {
  1720.     if ([$0])
  1721.     {
  1722.         ^ban $0
  1723.         @ KN = [$0]
  1724.         ^assign KR $1-
  1725.         wait -CMD if (1) {
  1726.             //^kick $C $KN $KR
  1727.             ^assign -KN
  1728.             ^assign -KR
  1729.         }
  1730.     } {/echo *** /bk <nick> [<reason>]}
  1731. }
  1732.  
  1733. alias leave {^if ([$0]) {^if (ischannel($0)) {//leave $*} {//leave #$*}} {//leave $C}}
  1734. alias part {/leave $*}
  1735. alias join {^if ((ischannel($0))||(match(-* $0))) {//join $*} {//join #$*}}
  1736.  
  1737. # Yet another command that is destined to show up in tons of other scripts :)
  1738. # /avoid <nick> or /avoid - <nick> ... just /avoid displays a list
  1739. alias avoid {
  1740.     if ([$0])
  1741.     {
  1742.         if ([$0] == [-])
  1743.         {
  1744.             if ([$1])
  1745.             {
  1746.                 if (match($1 $PP.SET.AVOID))
  1747.                 {
  1748.                     ^delword $1 $PP.SET.AVOID
  1749.                     @ PP.SET.AVOID = NLIST
  1750.                     ^assign -NLIST
  1751.                     echo *** Nick $1 removed from aviodance list
  1752.                 }
  1753.                 {
  1754.                     if ([$1] == [*])
  1755.                     {
  1756.                         ^assign -PP.SET.AVOID
  1757.                         echo *** Avoidance list cleared
  1758.                     } {/echo *** Nick $1 is not on your avoidance list}
  1759.                 }
  1760.             } {/echo *** /avoid - <nick>}
  1761.         }
  1762.         {
  1763.             if (match($1 $PP.SET.AVOID)) {/echo *** Nick $0 is already on your avoidance list}
  1764.             {
  1765.                 @ PP.SET.AVOID = PP.SET.AVOID##[$0 ]
  1766.                 echo *** Nick $0 added to avoidance list
  1767.                 if (!match($0 $PP.SET.NOTIFY)) {^notify $0}
  1768.             }
  1769.         }
  1770.     } {/echo *** Avoidance list: $PP.SET.AVOID}
  1771. }
  1772.  
  1773. alias cstats {
  1774.     @ CSOPS = 0
  1775.     @ CSNOPS = 0
  1776.     @ CSOPERS = 0
  1777.     @ CSHERE = 0
  1778.     @ CSGONE = 0
  1779.     @ CSUCOUNT = 0
  1780.     @ CSFARTHEST = 0
  1781.     ^on ^who * {
  1782.         if (match(*@* $2)) {@ CSOPS = CSOPS + 1} {@ CSNOPS = CSNOPS + 1}
  1783.         if ((mid(1 1 $2) == [*])||(mid(2 1 $2) == [*])) {@ CSOPERS = CSOPERS + 1}
  1784.         if (match(*H* $2)) {@ CSHERE = CSHERE + 1} {@ CSGONE = CSGONE + 1}
  1785.         @ CSUCOUNT = CSUCOUNT + 1
  1786.         if ([$5] > CSFARTHEST) {@ CSFARTHEST = [$5]}
  1787.     }
  1788.     if (ischannel($0)) {@ CSCHAN = [$0]} {@ CSCHAN = C}
  1789.     //^who $CSCHAN
  1790.     wait -CMD if (1) {
  1791.         ^on who -
  1792.         echo *** Stats for channel ${CSCHAN}:
  1793.         echo *** Total Users:${CSUCOUNT}   Ops:${CSOPS}   Non-ops:${CSNOPS}   IRCOps:${CSOPERS}
  1794.         echo *** Here:${CSHERE}   Away:${CSGONE}   Server hops to farthest user:${CSFARTHEST}
  1795.         ^assign -CSOPS
  1796.         ^assign -CSNOPS
  1797.         ^assign -CSCHAN
  1798.         ^assign -CSOPERS
  1799.         ^assign -CSHERE
  1800.         ^assign -CSGONE
  1801.         ^assign -CSUCOUNT
  1802.         ^assign -CSFARTHEST
  1803.     }
  1804. }
  1805.  
  1806. # We alias the notify list so we can keep track of it and save it with /sve
  1807. alias pp.notifychk {
  1808.     if ([$0] == [-]) {^assign -PP.SET.NOTIFY}
  1809.     {
  1810.         @ AA = 0
  1811.         while (word($AA $*))
  1812.         {
  1813.             if (match(-* $word($AA $*)))
  1814.             {
  1815.                 if (PP.SET.NOTIFY)
  1816.                 {
  1817.                     ^delword $mid(1 1000 $word($AA $*)) $PP.SET.NOTIFY
  1818.                     @ PP.SET.NOTIFY = NLIST
  1819.                     ^assign -NLIST
  1820.                 }
  1821.             }
  1822.             {
  1823.                 if (!match($word($AA $*) $PP.SET.NOTIFY)) {@ PP.SET.NOTIFY = PP.SET.NOTIFY##[$word($AA $*) ]}
  1824.             }
  1825.             @ AA = AA + 1
  1826.         }
  1827.     }
  1828. }
  1829. alias notify {
  1830.     //notify $*
  1831.     if ([$0]) {^pp.notifychk $*}
  1832. }
  1833.  
  1834. alias version {
  1835.     if ([$0]) {^if (match(*.* $0)) {//version $*} {//ctcp $0 VERSION}}
  1836.     {
  1837.         //version
  1838.         echo *** PurePak: version $PPVERS
  1839.     }
  1840. }
  1841.  
  1842. alias rwhois {^if ([$0]) {/whois $0 $0} {/whois $N}}
  1843. alias whois {
  1844.     @ WHOISINPROGRESS = 1
  1845.     //whois $*
  1846.     wait -CMD if (1) {^timer 2 ^assign -WHOISINPROGRESS}
  1847. }
  1848.  
  1849. # /nslookup <nick> or /nslookup <ip address>
  1850. alias nslookup {
  1851.     if ([$0])
  1852.     {
  1853.         if (match(*.* $0)) {^pp.dolookup $0}
  1854.         {
  1855.             ^Userhost $0 -CMD if ([$3]) {
  1856.                 if ([$4] != [<UNKNOWN>])
  1857.                 {
  1858.                     if (!isalpha($4)) {^pp.dolookup $4}
  1859.                     {/echo *** $0 is not online as an IP address}
  1860.                 } {/echo *** $0 is not on IRC}
  1861.             }
  1862.         }
  1863.     } {/echo *** /nslookup <nick> -or- /nslookup <ip address>}
  1864. }
  1865. alias pp.dolookup {
  1866.     if (!LOOKINGUP)
  1867.     {
  1868.         exec -name NSLOOKUP $PP.SET.NSLOOKCMD $0
  1869.         @ IPAD = [$0]
  1870.         @ LOOKINGUP = 1
  1871.     }
  1872. }
  1873. on ^exec "NSLOOKUP *" {}
  1874. on ^exec_error "NSLOOKUP *" {}
  1875. on ^exec "NSLOOKUP *Name*" {^pp.gn $*}
  1876. on ^exec_error "NSLOOKUP *Name*" {^pp.gn $*}
  1877. on ^exec_exit "NSLOOKUP *" {
  1878.     if (NSHOST) {/echo *** $IPAD is ${NSHOST}} {/echo *** Could not resolve a hostname for $IPAD}
  1879.     ^assign -NSHOST
  1880.     ^assign -IPAD
  1881.     ^assign -LOOKINGUP
  1882. }
  1883. alias pp.gn {
  1884.     @ AA = 0
  1885.     while (word($AA $*))
  1886.     {
  1887.         if (match(*.* $word($AA $*))) {@ NSHOST = word($AA $*)}
  1888.         @ AA = AA + 1
  1889.     }
  1890. }
  1891.  
  1892. alias ig {
  1893.     if ([$0])
  1894.     {
  1895.         ^Userhost $0 -CMD if ([$3]) {
  1896.             if ([$4] != [<UNKNOWN>]) {/ignore *$strip(~ $3)@$4 MSG NOTICE CTCP PUBLIC} {/echo *** $0 is not on IRC}
  1897.         }
  1898.     } {/echo *** /ig <nick>}
  1899. }
  1900. alias unig {
  1901.     if ([$0])
  1902.     {
  1903.         ^Userhost $0 -CMD if ([$3]) {
  1904.             if ([$4] != [<UNKNOWN>]) {/ignore *$strip(~ $3)@$4 NONE} {/echo *** $0 is not on IRC}
  1905.         }
  1906.     } {/echo *** /unig <nick>}
  1907. }
  1908. # Snak adaptation 1.2. Snaks ischanop is correct and these checks take time
  1909. # Snak adaptation 1.4. Don't reformat /who output - take out alias aw
  1910. alias who {
  1911.     if ((!DOINGWHO)&&(!SYNCING))
  1912.     {
  1913. #        ^on ^who * {
  1914. #            @ PP.USERS[$WINNUM()][$encode($tolower($0))][$encode($tolower($1))] = [$0 $1 $3@$4]
  1915. #            if (match(*@* $2))
  1916. #            {
  1917. #                if ((!ischanop($1 $0))&&(!PP.ICWARNED))
  1918. #                {
  1919. #                    echo *** Warning: your client's ischanop() function is inaccurate \($1 is op, ischanop() reports not op\)\; channel op status on /users lists may be wrong
  1920. #                    @ PP.ICWARNED = 1
  1921. #                }
  1922. #            }
  1923. #            {
  1924. #                if ((ischanop($1 $0))&&(!PP.ICWARNED))
  1925. #                {
  1926. #                    echo *** Warning: your client's ischanop() function is inaccurate \($1 is not op, ischanop() reports op\)\; channel op status on /users lists may be wrong
  1927. #                    @ PP.ICWARNED = 1~
  1928. #                }
  1929. #            }
  1930. #            aw $*
  1931. #        }
  1932. #        ^if (!PP.EPIC) {^alias aw {/xecho -level CRAP $[10]0 $[9]1 $[3]2 [$[2]5]  $3@$4 \($6-\)}}
  1933. #        {^alias aw {/xecho -level CRAP $[10]0 $[9]1 $[3]2 [$[2]6]  $3@$4 \($7-\)}}
  1934.         if ([$0]) {//who $*} {//who *}
  1935. #        @ DOINGWHO = 1
  1936. #        ^wait -CMD if (1) {
  1937. #            ^alias -aw
  1938. #            ^on who -
  1939. #            ^assign -DOINGWHO
  1940. #        }
  1941.     } {^if (SYNCING) {/echo *** /users synchronization in progress\; try again in a few seconds}}
  1942. }
  1943.  
  1944. alias serv {//server $*}
  1945. alias umode {//mode $N $*}
  1946.  
  1947. # Unflash command that should work on ALL clients
  1948. alias unflash {
  1949.     if (V <= 19930629)
  1950.     {
  1951.         ^set status_clock c
  1952.         ^type ^L
  1953.         ^set status_clock \;\24r
  1954.         ^type ^L
  1955.         ^set status_clock m
  1956.         ^type ^L
  1957.         ^set status_clock ?5l
  1958.         ^type ^L
  1959.         sleep 1
  1960.         ^set status_clock  %T
  1961.         ^type ^L
  1962.         echo *** Screen restored
  1963.     }
  1964.     {
  1965.         if ([$TTY])
  1966.         {
  1967.             if (match(*/* $TTY)) {^assign MYTTY $TTY} {^assign MYTTY /dev/$TTY}
  1968.             ^exec -name unflash echo c >>$MYTTY
  1969.             ^exec -name unflash echo \\\;\24r >>$MYTTY
  1970.             ^exec -name unflash echo m >>$MYTTY
  1971.             ^exec -name unflash echo ?5l >>$MYTTY
  1972.             ^exec -name unflash reset >>$MYTTY
  1973.             wait -CMD %unflash if (1) {
  1974.                 ^type ^L
  1975.                 ^assign -MYTTY
  1976.                 echo *** Screen restored
  1977.             }
  1978.         } {/echo *** UNFLASH FAILED: ENVIRONMENT VARIABLE 'TTY' MUST BE SET TO YOUR TTY.  SEE README.PPK}
  1979.     }
  1980. }
  1981.  
  1982. alias mail {
  1983.     if ([$0])
  1984.     {
  1985.         ^assign MAILFILE $1-
  1986.         ^Userhost $0 -CMD if ([$3]) {
  1987.             if ([$3] != [<UNKNOWN>])
  1988.             {
  1989.                 exec $PP.SET.MAILCMD $strip(~ $3)@$4 < $MAILFILE
  1990.                 echo *** Mailed $MAILFILE to $strip(~ $3)@$4
  1991.                 ^assign -MAILFILE
  1992.             } 
  1993.             {
  1994.                 echo *** $0 is not on IRC
  1995.                 ^assign -MAILFILE
  1996.             }
  1997.         }
  1998.     } {/echo *** /mail <nick> <file>}
  1999. }
  2000. alias uumail {
  2001.     if ([$0]) {
  2002.         ^assign MAILFILE $1-
  2003.         ^Userhost $0 -CMD if ([$3]) {
  2004.             if ([$3] != [<UNKNOWN>])
  2005.             {
  2006.                 exec $PP.SET.UUECMD $MAILFILE $MAILFILE | $PP.SET.MAILCMD $strip(~ $3)@$4
  2007.                 echo *** Mailed $MAILFILE to $strip(~ $3)@$4 (uuencoded)
  2008.                 ^assign -MAILFILE
  2009.             }
  2010.             {
  2011.                 echo *** $0 is not on IRC
  2012.                 ^assign -MAILFILE
  2013.             }
  2014.         }
  2015.     } {/echo *** /uumail <nick> <file>}
  2016. }
  2017.  
  2018. alias topic {^if (ischannel($0)) {//topic $*} {//topic $C $*}}
  2019.  
  2020. alias net {
  2021.     if ([$0])
  2022.     {
  2023.         echo *** Creating a window on server $0
  2024.         echo *** Type ^W to switch between windows and /wk to kill the current window.
  2025.         window new
  2026.         if ([$1]) {/EVAL window server $0:$1::_$N} {/EVAL window server $0:6667::_$N}
  2027.     }
  2028.     {
  2029.         echo *** /net <server> [<port>]
  2030.         echo ***
  2031.         echo *** /net creates a new window and connects it to <server>.  To
  2032.         echo *** switch windows, hit ^W
  2033.         echo ***
  2034.         echo *** /wk kills the current window.
  2035.         echo *** /wh hides the current window.
  2036.         echo *** /ws shows all windows.
  2037.     }
  2038. }
  2039. alias wk {/window kill}
  2040. alias wh {/window hide}
  2041. alias ws {
  2042.     window show 2
  2043.     window show 1
  2044.     window balance
  2045. }
  2046.  
  2047. alias massinv {
  2048.     if ([$0])
  2049.     {
  2050.         ^on ^who * {
  2051.             if (([$1] != N)&&([$0] != C)) {/EVAL ^timer $rand(30) //invite $1 $C}
  2052.         }
  2053.         echo *** Inviting users found with command '/who $*' to channel $C
  2054.         //^who $*
  2055.         wait -CMD ^on who -
  2056.     } {/echo *** /massinv <who params>   - Where <who params> is exactly as if it were a /who command.}
  2057. }
  2058.     
  2059. alias cycle {lj}
  2060. alias lj {
  2061.     @ OC = C
  2062.     //leave $C
  2063.     wait -CMD if (1) {
  2064.         //join $OC
  2065.         ^assign -OC
  2066.     }
  2067. }
  2068.  
  2069. alias signoff {
  2070.     if ([$0])
  2071.     {
  2072.         echo *** Signoff: $N \($*\)
  2073.         //signoff $*
  2074.     }
  2075.     {
  2076.         echo *** Signoff: $N \(Leaving\)
  2077.         //signoff Leaving
  2078.     }
  2079. }
  2080. alias exit {/signoff $*}
  2081. alias quit {/signoff $*}
  2082. alias bye {/signoff $*}
  2083.  
  2084. alias ls {/exec $PP.SET.LSCMD $*}
  2085. alias lsw {
  2086.     @ OLDTABMAX = TAB_MAX
  2087.     ^set TAB_MAX 64
  2088.     exec -name lsw $PP.SET.LSWCMD $*
  2089.     wait -CMD %lsw if (1) {
  2090.         ^set TAB_MAX $OLDTABMAX
  2091.         ^assign -OLDTABMAX
  2092.     }
  2093. }
  2094. alias rm {^if ([$0]) {/exec $PP.SET.RMCMD $*} {/echo *** /rm [<rm options>] <filenames>}}
  2095. alias cat {^if ([$0]) {/exec $PP.SET.CATCMD $*} {/echo *** /cat <filename>}}
  2096. on ^exec "MSGCAT *" {
  2097.     if (!match(=* $MCAT))
  2098.     {
  2099.         ^timer $MCATCTR //msg $MCAT $1-
  2100.         @ MCATCTR = MCATCTR + (rand(2) + 1)
  2101.     } {//msg $MCAT $1-}
  2102. }
  2103. on ^exec_exit "MSGCAT *" {
  2104.     ^assign -MCAT
  2105.     ^assign -MCATCTR
  2106. }
  2107. alias catto {
  2108.     if ([$1])
  2109.     {
  2110.         @ MCAT = [$0]
  2111.         @ MCATCTR = 2
  2112.         exec -name MSGCAT $PP.SET.CATCMD $1
  2113.     }
  2114.     {^if ([$0]) {/catto $C $0} {/echo *** /catto <nick/channel> <file> -or- /catto <file> (goes to current channel)}}
  2115. }
  2116. alias ps {/exec $PP.SET.PSCMD $*}
  2117. alias pskill {^if ([$0]) {/exec $PP.SET.KILLCMD $*} {/echo *** /pskill <pid(s) to kill>}}
  2118.  
  2119. alias pp.awaylog {
  2120.     ^assign AWAYLOG[$PP.AWAYLCTR] $*
  2121.     if (PBFILE) {^pp.playback $*}
  2122.     @ PP.AWAYLCTR = PP.AWAYLCTR + 1
  2123. }
  2124. alias pp.pe {^if (PBFILE) {^msg %pbfile $strip( $*)} {/echo $*}}
  2125. alias pp.playback {
  2126.     if ([$1] == [MSG]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] [$3!$strip(~ $2)] $4-}
  2127.     if ([$1] == [NOTICE]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] -$3!$strip(~ $2)- $4-}
  2128.     if ([$1] == [KICK]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] Kicked from $4 by $3 [$strip(~ $2)] \($5-\)}
  2129.     if ([$1] == [BAN]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] $3 [$strip(~ $2)] banned you from $4 with bans: $5-}
  2130.     if ([$1] == [FLOOD]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] $4- from $3 [$strip(~ $2)] detected}
  2131.     if ([$1] == [DEOP]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] $3 [$strip(~ $2)] deopped you on $4}
  2132.     if ([$1] == [OP]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] $3 [$strip(~ $2)] opped you on $4}
  2133.     if ([$1] == [DCC]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] DCC $4 \($5\) received from $2 [$strip(~ $3)]}
  2134. }
  2135. alias playback {
  2136.     if (AWAYLOG[0])
  2137.     {
  2138.         if (PBFILE)
  2139.         {
  2140.             @ PBFILE_OLD = PBFILE
  2141.             ^assign -PBFILE
  2142.         }
  2143.         @ CTR = 0
  2144.         ^pp.pauseset
  2145.         while (CTR <= PP.AWAYLCTR)
  2146.         {
  2147.             ^pp.playback $AWAYLOG[$CTR]
  2148.             @ CTR = CTR + 1
  2149.         }
  2150.         ^pp.pauseend
  2151.         ^assign -CTR
  2152.         if (PBFILE_OLD)
  2153.         {
  2154.             @ PBFILE = PBFILE_OLD
  2155.             ^assign -PBFILE_OLD
  2156.         }
  2157.     } {/echo *** No messages or events to play back}
  2158. }
  2159. alias clearlog {
  2160.     foreach AWAYLOG AA {^assign -AWAYLOG[$AA]}
  2161.     @ PP.AWAYLCTR = 0
  2162.     echo *** Away log is now empty
  2163. }
  2164.             
  2165. alias away {
  2166.     if (!(A))
  2167.     {
  2168.         if ([$0]) {//away $*}
  2169.         {
  2170.             if (index(G $PP.SET) >= 0) {//away All messages will be logged...} {//away Gone...}
  2171.         }
  2172.         wait -CMD if (1) {
  2173.             if ((!!(C))&&(index(O $PP.SET) >= 0))
  2174.             {
  2175.                 ^assign SEND_MSG ACTION is away: ${A}
  2176.                 ^pp.listmsg PRIVMSG $mychannels()
  2177.                 ^assign -SEND_MSG
  2178.                 echo * $N is away: $A
  2179.             }
  2180.         }
  2181.         if (index(H $PP.SET) >= 0)
  2182.         {
  2183.             ^assign PBFILE $PP.SET.ALFILE
  2184.             ^exec -name pbfile $PP.SET.CATCMD >>$PBFILE
  2185.             echo *** Away log file ${PBFILE} opened
  2186.         }
  2187.         @ PP.AWAYSINCE = Z
  2188.     }
  2189.     {
  2190.         //away
  2191.         wait -CMD if (1) {
  2192.             ^assign -PP.AWAYSINCE
  2193.             if (index(G $PP.SET) >= 0) {/echo *** Type /playback to play back away log, type /clearlog to clear away log.}
  2194.             if ((!!(C))&&(index(O $PP.SET) >= 0))
  2195.             {
  2196.                 ^assign SEND_MSG ACTION is back.
  2197.                 ^pp.listmsg PRIVMSG $mychannels()
  2198.                 ^assign -SEND_MSG
  2199.                 echo * $N is back.
  2200.             }
  2201.         }
  2202.         if (index(H $PP.SET) >= 0)
  2203.         {
  2204.             ^exec -close %pbfile
  2205.             echo *** Away log file ${PBFILE} closed
  2206.             ^assign -PBFILE
  2207.         }
  2208.     }
  2209. }
  2210.  
  2211. # paway <nick> <msg/->
  2212. alias paway {
  2213.     if ([$0])
  2214.     {
  2215.         if ([$1])
  2216.         {
  2217.             if ([$1] == [-])
  2218.             {
  2219.                 ^assign -PP.PAWAYS[$encode($toupper($0))]
  2220.                 echo *** Personal away message for $0 removed
  2221.             }
  2222.             {
  2223.                 @ PP.PAWAYS[$encode($toupper($0))] = [$1-]
  2224.                 echo *** Personal away message for $0 added: $1-
  2225.             }
  2226.         }
  2227.         {
  2228.             if (PP.PAWAYS[$encode($toupper($0))]) {/echo *** Personal away message for $0: $PP.PAWAYS[$encode($toupper($0))]}
  2229.             {/echo *** No personal away message set for $0}
  2230.         }
  2231.     }
  2232.     {
  2233.         echo *** Nick       Message
  2234.         foreach PP.PAWAYS AA {/echo *** $[10]decode($AA) $PP.PAWAYS[$AA]}
  2235.     }
  2236. }
  2237.  
  2238. alias write {/comment $write($*)}
  2239. # Snak adaptation 1.7 use "log_extrainfo off" to prevent Snak from writing "server:" or "info:" before each line when logging
  2240. alias sve {
  2241.     if (!(HOME))
  2242.     {
  2243.         exec -name rm $PP.SET.RMCMD $PP.SAVEFILE
  2244.         echo *** Warning: Your home directory could not be determined.  Your saved settings file will be saved to the current working directory.  If this isn't your home directory, PurePak may not be able to find it's saved settings file at startup!
  2245.     } {/exec -name rm $PP.SET.RMCMD ${HOME}/$PP.SAVEFILE}
  2246.     wait -CMD %rm if (1) {
  2247.         if (PP.EPIC)
  2248.         {
  2249.             if (!(HOME)) {@ FHANDLE = open($PP.SAVEFILE w)} {@ FHANDLE = open(${HOME}/$PP.SAVEFILE w)}
  2250.             if (FHANDLE > 0) {/EVAL ^assign WM /write $FHANDLE}
  2251.             {
  2252.                 echo *** Could not open target file!
  2253.                 @ WM = [/comment]
  2254.             }
  2255.         }
  2256.         {
  2257.             @ WM = [/xecho -WINDOW WRITEOUT]
  2258.             ^window new
  2259.             ^window log_extrainfo off
  2260.             ^window hold_mode off
  2261.             ^window name WRITEOUT
  2262.             if (!(HOME)) {^window logfile $PP.SAVEFILE} {^window logfile ${HOME}/$PP.SAVEFILE}
  2263.             ^window log on
  2264.         }
  2265.         $WM # PurePak version $PPVERS saved settings file
  2266.         $WM # Written $stime($time())
  2267.         foreach PP.SET AA {$WM @ PP.SET.$AA = [$PP.SET[$AA]]}
  2268.         foreach PP.PAWAYS AA {$WM @ PP.PAWAYS.$AA = [$PP.PAWAYS[$AA]]}
  2269.         $WM @ PP.SET = [$PP.SET]
  2270.         $WM ^set beep_on_msg $beep_on_msg
  2271.         $WM ^set flood_rate $flood_rate
  2272.         $WM ^set flood_after $flood_after
  2273.         $WM ^set shell $shell
  2274.         $WM ^set suppress_server_motd $suppress_server_motd
  2275.         foreach PP.FRIENDS AA {$WM @ PP.FRIENDS[$AA] = [$PP.FRIENDS[$AA]]}
  2276.         foreach PP.ENEMIES AA {$WM @ PP.ENEMIES[$AA] = [$PP.ENEMIES[$AA]]}
  2277.         $WM ^pp.savedfrom $strip(.ba $PPVERS)
  2278.         $WM echo *** Saved settings loaded from ${PP.SAVEFILE}
  2279.         if (match(*xecho* $WM))
  2280.         {
  2281.             ^window log off
  2282.             ^window kill
  2283.         }
  2284.         {
  2285.             comment $close($FHANDLE)
  2286.             ^assign -FHANDLE
  2287.         }
  2288.         ^assign -WM
  2289.         echo *** Current settings saved to ${PP.SAVEFILE}
  2290.     }
  2291. }
  2292. alias pp.savedfrom {
  2293.     if ([$0] < 109)
  2294.     {
  2295.         ^alias echo {}
  2296.         foreach FRIENDS AA {
  2297.             ^pp.addl FRIENDS $FRIENDS[$AA] *
  2298.             ^assign -FRIENDS[$AA]
  2299.         }
  2300.         foreach ENEMIES AA {
  2301.             ^pp.addl ENEMIES $ENEMIES[$AA] *
  2302.             ^assign -ENEMIES[$AA]
  2303.         }
  2304.         ^alias -echo
  2305.         ^timer 30 /echo *** Your old friends/enemies lists from your previous version of PurePak have been added to the 'global' friends/enemies lists in this version.  You should /sve now to save the lists in the new format. (Type /lsfriends and /lsenemies to check your lists)
  2306.     }
  2307.     if ([$0] < 205)
  2308.     {
  2309.         foreach PP.PAWAYS AA {
  2310.             @ PP.PAWAYS[$encode($toupper($AA))] = PP.PAWAYS[$AA]
  2311.             ^assign -PP.PAWAYS[$AA]
  2312.             ^timer 30 /echo *** There have been changes to the saved file format.  Auto-converted, but you should /sve now so you don't see this message again.
  2313.         }
  2314.     }
  2315.     ^timer 5 ^alias -pp.savedfrom
  2316. }
  2317.  
  2318. # So the "IRC log started ..." comments in the logfile do nothing
  2319. alias IRC {}
  2320. alias pphelp {
  2321.     if ([$0]) {
  2322.         if (!(PPHELP.HELP)) 
  2323.         {
  2324.             ^set input_prompt Loading help database...
  2325.             //^load purepak.hlp
  2326.             ^set -input_prompt
  2327.             if (!(PPHELP.HELP)) {/echo *** Error loading purepak.hlp: check to make sure that the file exists and is in a directory where it can be found.} {/pphelp $*}
  2328.         }
  2329.         {
  2330.             @ PP.HELPLASTUSED = time()
  2331.             if ([$1]) {@ EN = [$0_$1]} {@ EN = [$0]}
  2332.             if (!(PPHELP[$EN][0])) {/echo *** No help available on '$*'}
  2333.             {
  2334.                 ^pp.pauseset
  2335.                 echo *** Help: $*
  2336.                 foreach PPHELP.$EN AA {/echo -- $PPHELP[$EN][$AA]}
  2337.                 echo --
  2338.                 ^pp.pauseend
  2339.             }
  2340.             ^assign -EN
  2341.         }
  2342.     } {/pphelp HELP}
  2343. }
  2344.  
  2345. alias lockmode {
  2346.     if ([$0])
  2347.     {
  2348.         if (!ischannel($0)) {/echo *** /lockmode <#channel> <mode(s) to lock/off>}
  2349.         {
  2350.             if ([$1])
  2351.             {
  2352.                 if ([$1] == [OFF])
  2353.                 {
  2354.                     if (!(LOCKEDMODES[$encode($0)])) {/echo *** No modes are locked on $0}
  2355.                     {
  2356.                         ^assign -LOCKEDMODES[$encode($0)]
  2357.                         if (gotops($0))
  2358.                         {
  2359.                             if (index(W $PP.SET) >= 0)
  2360.                             {
  2361.                                 if ([$0] == C) {/me : Mode no longer locked} {/describe $0 : Mode no longer locked}
  2362.                             }
  2363.                         }
  2364.                         echo *** Mode on channel $0 no longer locked
  2365.                     }
  2366.                 }
  2367.                 {
  2368.                     if (rmatch($1 *-* *o* *v*)) {/echo *** Cannot lock that mode.  /pphelp lockmode for help.}
  2369.                     {
  2370.                         ^assign LOCKEDMODES[$encode($0)] $1-
  2371.                         if (gotops($0))
  2372.                         {
  2373.                             if (index(W $PP.SET) >= 0)
  2374.                             {
  2375.                                 if ([$0] == C) {/me : Mode locked to: $1-} {/describe $0 : Mode locked to: $1-}
  2376.                             }
  2377.                             ^clearmode $0
  2378.                             EVAL ^on #^mode 2 * {//mode $1 $LOCKEDMODES[$encode($1)];^on #mode 2 - *}
  2379.                         } {/echo *** Warning: you don't have ops on $0!}
  2380.                         echo *** Mode on channel $0 locked to: $1-
  2381.                     }
  2382.                 }
  2383.             } {/echo *** /lockmode <#channel> <mode(s) to lock/off>}
  2384.         }
  2385.     }
  2386.     {
  2387.         echo *** Channels/modes currently locked:
  2388.         foreach LOCKEDMODES AA {/echo *** Channel: $decode($AA)   Mode: $LOCKEDMODES[$AA]}
  2389.     }
  2390. }
  2391.  
  2392. alias pp.last {/sendto $0 [$2!$strip(~ $1)] $3-}
  2393. alias pp.lastn {/sendto $0 -$2!$strip(~ $1)- $3-}
  2394. # User /last and /lastn commands
  2395. alias last {^if ([$0]) {/pp.last $0 $PP.LMSG} {/pp.last $C $PP.LMSG}}
  2396. alias lastn {^if ([$0]) {/pp.lastn $0 $PP.LNOTICE} {/pp.lastn $C $PP.LNOTICE}}
  2397.  
  2398. # ----------------------------------------------------------------------------
  2399. # Standard on handlers
  2400. # ----------------------------------------------------------------------------
  2401.  
  2402. # Don't show error notices from deop*4's from old servers
  2403. on ^401 "% % No such nick (channel)" {}
  2404.  
  2405. # Make names look like it does when you join a channel
  2406. on ^names * {/echo *** Users on $0: $1-}
  2407.  
  2408. # Snak adaptation 1.1 they conflict with normal message formatting
  2409. #on ^send_public * {
  2410. #    if ([$0] == C) {/echo <${N}> $1-}
  2411. #    {
  2412. #        echo -> $0 <${N}> $1-
  2413. #        ^tk.addmsg $0 $tk.msglist
  2414. #    }
  2415. #}
  2416. #on ^send_msg * {
  2417. #    ^pp.formecho $PP.SET.MSFORMAT $0 X $1-
  2418. #    ^tk.addmsg $0 $tk.msglist
  2419. #}
  2420. #on ^send_notice * {
  2421. #    ^pp.formecho $PP.SET.NSFORMAT $0 X $1-
  2422. #    ^tk.addmsg $0 $tk.msglist
  2423. #}
  2424.  
  2425. on -send_public * {^tk.addmsg $0 $tk.msglist}
  2426. on -send_msg * {^tk.addmsg $0 $tk.msglist}
  2427. on -send_notice * {^tk.addmsg $0 $tk.msglist}
  2428.  
  2429.  
  2430. on -send_dcc_chat * {^tk.addmsg =$0 $tk.msglist}
  2431.  
  2432. # Checks to see if a message contains any known floods
  2433. alias pp.fp.msgsafe {
  2434.     @ FUNCTION_RETURN = 1
  2435.     if (index(F $PP.SET) >= 0)
  2436.     {
  2437.         if (match(**** $*)) {@ FUNCTION_RETURN = 0}
  2438.         {
  2439.             ^if (rindex($right(1 $0) $0) >= PP.SET.JFLEN) {@ FUNCTION_RETURN = 0}
  2440.             {
  2441.                 ^if (left(10 $*) == [         ]) {@ FUNCTION_RETURN = 0}
  2442.             }
  2443.         }
  2444.     }
  2445. }
  2446.  
  2447. # Public flood/tsunami filters
  2448. alias pp.fp.pubecho {^if ([$1] == C) {/echo <$0> $2-} {/echo <$0:$1> $2-}}
  2449. on ^public "% % *****" {
  2450.     if (index(F $PP.SET) >= 0) {/pp.fp.pubecho $0 $1 [flood detected]} {/pp.fp.pubecho $*}
  2451.     if (PP.SET.CHANPROT) {//kick $1 $0 [Possible beep/tsunami flood]}
  2452. }
  2453. on ^public_notice "% % *****" {
  2454.     if (index(F $PP.SET) >= 0) {/echo -$0:${1}- [flood detected]} {/echo -$0:${1}- $2-}
  2455.     if (PP.SET.CHANPROT) {//kick $1 $0 [Possible beep/tsunami flood]}
  2456. }
  2457. on ^public_msg "% % *****" {
  2458.     if (index(F $PP.SET) >= 0) {/echo \($0/$1\) [flood detected]} {/echo \($0/$1\) $2-}
  2459.     if (PP.SET.CHANPROT) {//kick $1 $0 [Possible beep/tsunami flood]}
  2460. }
  2461.  
  2462. # Msg and notice handlers
  2463. # Snak adaptation 1.4 pp.formecho removed as it conflicts with normal message formatting
  2464. # removed ^ to let Snak process the message
  2465. on msg * {
  2466.     if (pp.fp.msgsafe($1-))
  2467.     {
  2468.         ^tk.addmsg $0 $tk.msglist
  2469.     } 
  2470.     ^assign PP.LMSG $USERHOST() $*
  2471.     if ((!!(A))&&(index(G $PP.SET) >= 0))
  2472.     {
  2473.         if ((index(W $PP.SET) >= 0)&&(!match($0 $LAWAYN)))
  2474.         {
  2475.             if ([$0] != N) {
  2476.                 if (!PP.PAWAYS[$encode($toupper($0))]) {//^notice $0 [PurePak] I am away... Messages are being logged  [since ${PP.AWAYSINCE}]}
  2477.                 {//^notice $0 [AWAY] $PP.PAWAYS[$encode($toupper($0))]  [since ${PP.AWAYSINCE}]}
  2478.             }
  2479.             if (!(LAWAYN)) {^timer 120 ^assign -LAWAYN}
  2480.             @ LAWAYN = [$0 ]##LAWAYN
  2481.         }
  2482.         ^pp.awaylog $time() MSG $USERHOST() $*
  2483.     }
  2484. }
  2485. # Snak adaptation 1.4 pp.formecho removed as it conflicts with normal message formatting
  2486. # removed ^ to let Snak process the message
  2487. on notice * {
  2488.     if (pp.fp.msgsafe($1-))
  2489.     {
  2490.         if (!rmatch($0 Help_* *@* *srv Irc*Help *bot *s?rv *b0t *.*)) {^tk.addmsg $0 $tk.msglist}
  2491.     } 
  2492.     @ PP.LNOTICE = [$USERHOST() $*]
  2493.     if ((!!(A))&&(index(G $PP.SET) >= 0)) {^pp.awaylog $time() NOTICE $USERHOST() $*}
  2494. }
  2495.  
  2496. # pp.formecho encode(<format>) <nick> <user@host> <msg>
  2497. # Speed improved by Tris, Speed improved still more by CKeeper
  2498. alias pp.formecho {
  2499.     @ AA = 0
  2500.     @ AB = decode($0)
  2501.     @ AC = mid(0 1 $AB)
  2502.     while (AC)
  2503.     {
  2504.         if (!strip(NUMT $AC))
  2505.         {
  2506.             if (AC == [N]) {@ AD = AD##[$1]}
  2507.             {if (AC == [U]) {@ AD = AD##[$2]}
  2508.             {if (AC == [M]) {@ AD = AD##[$3-]}
  2509.             {if (AC == [T]) {@ AD = AD##[<$word(3 $stime($time()))>]}}}}
  2510.         } {@ AD = AD##AC}
  2511.         @ AA = AA + 1
  2512.         @ AC = mid($AA 1 $AB)
  2513.     }
  2514.     echo $AD
  2515.     ^assign -AC
  2516.     ^assign -AD
  2517. }
  2518.  
  2519. # Make some notices look better and be more informative
  2520. on ^482 * {^if ([$0] != S) {/echo *** You are desynched on $1 \(from server $0\)} {/echo *** You are not channel operator on $1}}
  2521. on ^442 * {^if ([$0] != S) {^if (match($1 $mychannels())) {/echo *** You are desynched: server $0 doesn't think you are on channel $1} {/echo *** You are not on channel $1 \(from server $0\)}} {/echo *** You are not on channel $1}}
  2522. on ^465 * {/echo *** You are banned (K-lined) from server $0}
  2523.  
  2524. # Snak adaptation 1.7 Removed
  2525. # on ^333 * {^if (!match(*.* $2)) {/echo *** Topic was set on $1 by $2 at $stime($3)}}
  2526. on ^375 * {^if ((suppress_server_motd != [ON])||(PP.SEENMOTD)) {/echo ++ $1-}}
  2527. on ^372 * {^if ((suppress_server_motd != [ON])||(PP.SEENMOTD)) {/echo -- $1-}}
  2528. on ^376 * {@ PP.SEENMOTD = 1}
  2529. EVAL ^if (PP.EPIC) {
  2530.     on ^323 * {}
  2531.     on ^376 * {}
  2532.     on ^219 * {}
  2533. }
  2534.  
  2535. # Snak adaptation 1.1 Removed
  2536. # on ^leave * {/xecho -level CRAP *** $0 has left channel $1}
  2537. # on ^channel_signoff * {/xecho -level CRAP *** Signoff: $1 \($2-\) [$0]}
  2538.  
  2539. # Suppress annoying (and meaningless) "dgets timed out" notices
  2540. on ^window "% ??? *dgets timed out.*continuing*" {}
  2541. # And there's a typo in the client too!
  2542. on ^window "% ??? *dgets tiomed out.*continuing*" {}
  2543.  
  2544. # Don't show notices that you are away unless /whois'ing yourself
  2545. on ^window "% ??? % is away: *" {^if (([$2] != N)||(WHOISINPROGRESS)) {/echo $1-}}
  2546.  
  2547. # Anything to be done on join, like friends/enemies list checking
  2548. on #-join 2 * {
  2549.     if (gotops($1))
  2550.     {
  2551.         if (index(L $PP.SET) >= 0)
  2552.         {
  2553.             if (ispal($0!$USERHOST() $1))
  2554.             {
  2555.                 ^timer 2 /echo *** $0 is on your friends list: auto-opping on $1
  2556.                 //mode $1 +o $0
  2557.             }
  2558.         }
  2559.         if (index(E $PP.SET) >= 0)
  2560.         {
  2561.             if (isshit($0!$USERHOST() $1))
  2562.             {
  2563.                 ^timer 2 /echo *** $0 is on your enemies list: auto-bkicking off $1
  2564.                 //mode $1 -o+b $0 *!*$mid(1 1000 $USERHOST())
  2565.                 //kick $1 $0 [Auto-BKick]
  2566.             }
  2567.         }
  2568.         if ((index(C $PP.SET) >= 0)&&(!match($0 $PP.BOTNICKS $PP.CLONES)))
  2569.         {
  2570.             @ JHOST = mid(${index(@ $USERHOST())+1} $rindex($right(1 $USERHOST()) $USERHOST()) $USERHOST())
  2571.             if ([$JHOST$1] == LASTJHOST)
  2572.             {
  2573.                 @ PP.CPCTR = PP.CPCTR + 1
  2574.                 if (PP.CPCTR >= PP.SET.CPSENS)
  2575.                 {
  2576.                     //mode $1 +b *!*@$JHOST
  2577.                     wait -CMD ^pp.mkick $1 *@$JHOST [Clonebots Detected]
  2578.                     echo *** Clonebot mass-join protection engaged on $1 for bots at ${JHOST}
  2579.                     @ PP.CPCTR = 0
  2580.                 }
  2581.             }
  2582.             if (!(LASTJHOST))
  2583.             {
  2584.                 ^timer 4 ^assign -LASTJHOST
  2585.                 ^timer 4 @ PP.CPCTR = 0
  2586.             }
  2587.             @ LASTJHOST = JHOST##[$1]
  2588.             ^assign -JHOST
  2589.         }
  2590.     }
  2591.     if ((PP.SET.LOOKJOIN)&&(!LOOKINGUP))
  2592.     {
  2593.         if (!isalpha($mid(${index(@ $USERHOST())+1} 1000 $USERHOST())))
  2594.         {
  2595.             ^nslookup $mid(${index(@ $USERHOST())+1} 1000 $USERHOST())
  2596.         }
  2597.     }
  2598.     if (match($0 $PP.SET.AVOID))
  2599.     {
  2600.         echo *** Automatic avoiding engaged for $0: setting away
  2601.         if (!(A))
  2602.         {
  2603.             if (index(O $PP.SET) >= 0)
  2604.             {
  2605.                 @ OLD_PPSET = PP.SET
  2606.                 @ PP.SET = strip(O $PP.SET)
  2607.                 ^away bbl...
  2608.                 wait -CMD if (1) {
  2609.                     @ PP.SET = OLD_PPSET
  2610.                     ^assign -OLD_PPSET
  2611.                 }
  2612.             } {^away bbl...}
  2613.         }
  2614.     }
  2615.     if ([$0] != N) {^assign UHOSTCACHE[$encode($0)] $USERHOST()}
  2616. }
  2617.  
  2618. # Fetches a user@host from the user@host cache
  2619. alias getuh {^foreach UHOSTCACHE AA {^if (decode($AA) == [$0]) {@ FUNCTION_RETURN = UHOSTCACHE[$AA]}}}
  2620.     
  2621. on -raw_irc "% KICK *" {
  2622.     ^assign KNICK $nickonly($0)
  2623.     if ([$3] == N)
  2624.     {
  2625.         if ((!!(A))&&(index(G $PP.SET) >= 0)) {^pp.awaylog $time() KICK $mid(${index(! $0)+1} $rindex($right(1 $0) $0) $0) $KNICK $2 $strip(: $4) $5-}
  2626.         if (index(J $PP.SET) >= 0) {/EVAL ^timer 2 //^quote JOIN $2}
  2627.     }
  2628.     if ((index(M $PP.SET) >= 0)&&(gotops($2)))
  2629.     {
  2630.         if (([$0$2] == LASTKICKER)&&(!rand(4)))
  2631.         {
  2632.             if (!PP.SET.MASSRESP)
  2633.             {
  2634.                 //mode $2 -o $KNICK
  2635.                 if (index(W $PP.SET) >= 0) {^notice $KNICK [PurePak] Masskick on channel $2 from you detected}
  2636.             } {//kick $2 $KNICK [Masskick detected]}
  2637.             echo *** Masskick protection activated by ${KNICK} on $2
  2638.         }
  2639.         if (KNICK != N)
  2640.         {
  2641.             if (!(LASTKICKER)) {^timer 3 ^assign -LASTKICKER}
  2642.             @ LASTKICKER = [$0$2]
  2643.         }
  2644.     }
  2645.     if (PP.BOTS) {/bots.onkick $*}
  2646.     ^assign -KNICK
  2647. }
  2648.  
  2649. # Way too much crap is done here :P
  2650. on -mode "% #% *" {
  2651.     if ((index(M $PP.SET) >= 0)&&([$0] != N))
  2652.     {
  2653.         if ((gotops($1))&&(!match($0 $PP.BOTNICKS $PP.CLONES)))
  2654.         {
  2655.             if ((rmatch($2 *-ooo* *+o-o+o* *-o+o-o*))&&([$0] != LASTMASSER))
  2656.             {
  2657.                 if (!PP.SET.MASSRESP)
  2658.                 {
  2659.                     //mode $1 -o $0
  2660.                     if (index(W $PP.SET) >= 0) {^notice $0 [PurePak] Massdeop on channel $1 from you detected}
  2661.                 } {//kick $1 $0 [Massdeop detected]}
  2662.                 echo *** Massdeop protection activated by $0 on $1
  2663.                 ^assign LASTMASSER $0
  2664.                 ^timer 10 ^assign -LASTMASSER
  2665.             }
  2666.             {
  2667.                 if (match(*-o* $2))
  2668.                 {
  2669.                     if (([$0$1] == LASTDEOP)&&([$0] != LASTMASSER))
  2670.                     {
  2671.                         if (!PP.SET.MASSRESP)
  2672.                         {
  2673.                             //mode $1 -o $0
  2674.                             if (index(W $PP.SET) >= 0) {^notice $0 [PurePak] Massdeop on channel $1 from you detected}
  2675.                         } {//kick $1 $0 [Massdeop detected]}
  2676.                         echo *** Massdeop protection activated by $0 on $1
  2677.                         ^assign LASTMASSER $0
  2678.                         ^timer 10 ^assign -LASTMASSER
  2679.                     }
  2680.                     if (!(LASTDEOP)) {^if (match(*-oo* $2)) {^timer 4 ^assign -LASTDEOP} {^timer 2 ^assign -LASTDEOP}}
  2681.                     ^assign LASTDEOP $0$1
  2682.                 }
  2683.             }
  2684.         }
  2685.     }
  2686.     if ((match(*.* $0))&&(index(S $PP.SET) >= 0))
  2687.     {
  2688.         if ((match(*+o* $2))&&(gotops($1)))
  2689.         {
  2690.             if ((!match(*@* $3))&&(isalpha($3))) {^if (!ispal($3!$getuh($3) $1)) {@ SERVOPD = [$3]} {@ EXCLUDED = [$3]}}
  2691.             if ([$4]) {^if ((!match(*@* $4))&&(isalpha($4))) {^if (!ispal($4!$getuh($4) $1)) {^assign SERVOPD $4 $SERVOPD} {^assign EXCLUDED $4 $EXCLUDED}}}
  2692.             if ([$5]) {^if ((!match(*@* $5))&&(isalpha($5))) {^if (!ispal($5!$getuh($5) $1)) {^assign SERVOPD $5 $SERVOPD} {^assign EXCLUDED $5 $EXCLUDED}}}
  2693.             if ([$6]) {^if ((!match(*@* $6))&&(isalpha($6))) {^if (!ispal($6!$getuh($6) $1)) {^assign SERVOPD $6 $SERVOPD} {^assign EXCLUDED $6 $EXCLUDED}}}
  2694.             if ([$7]) {^if ((!match(*@* $7))&&(isalpha($7))) {^if (!ispal($7!$getuh($7) $1)) {^assign SERVOPD $7 $SERVOPD} {^assign EXCLUDED $7 $EXCLUDED}}}
  2695.             //mode $1 -oooo $SERVOPD
  2696.             if (SERVOPD) {/echo *** Server ops protection engaged on channel $1 for: ${SERVOPD}}
  2697.             if (EXCLUDED) {/echo *** These users are on your friends list and were excluded from server ops protection: ${EXCLUDED}}
  2698.             if ((index(W $PP.SET) >= 0)&&(!!(SERVOPD)))
  2699.             {
  2700.                 ^assign SEND_MSG [PurePak] Server ops from $0 to you on $1 detected, removed.
  2701.                 ^pp.listmsg NOTICE $SERVOPD
  2702.                 ^assign -SEND_MSG
  2703.             }
  2704.             ^assign -EXCLUDED
  2705.             ^assign -SERVOPD
  2706.         }
  2707.     }
  2708.     if (match(*+b* $2))
  2709.     {
  2710.         ^assign CHECKSTR ${N}!$PP.UHOST
  2711.         if (rmatch($CHECKSTR $3-))
  2712.         {
  2713.             if ([$0] == N) {/echo *** Warning: You just placed a ban on yourself on $1!}
  2714.             {
  2715.                 if (match($3 $CHECKSTR)) {@ MYBANS = [$3]}
  2716.                 if (match($4 $CHECKSTR)) {@ MYBANS = [$4 $MYBANS]}
  2717.                 if (match($5 $CHECKSTR)) {@ MYBANS = [$5 $MYBANS]}
  2718.                 if (match($6 $CHECKSTR)) {@ MYBANS = [$6 $MYBANS]}
  2719.                 ^pp.banprot $0 $1 $MYBANS
  2720.                 if ((!!(A))&&(index(G $PP.SET) >= 0)) {^pp.awaylog $time() BAN $USERHOST() $0 $1 $MYBANS}
  2721.                 ^assign -MYBANS
  2722.             }
  2723.         }
  2724.         ^assign -CHECKSTR
  2725.     }
  2726.     if ((index(K $PP.SET) >= 0)&&(match(*+k* $2)))
  2727.     {
  2728.         if ((match(** $3-))||(match(** $3-)))
  2729.         {
  2730.             ^set status_mode  *\(+k$M\)
  2731.             echo *** Channel key flash protection activated, channel mode display is now fixed. Normal mode display will resume when key is removed.
  2732.             EVAL ^on -mode "% $1 %-k% *" {
  2733.                 ^timer 2 ^set status_mode  (+%+)
  2734.                 EVAL ^on mode - "% $1 %-k% *"
  2735.             }
  2736.             if ((gotops($1))&&([$0] != N)) {//mode $1 -kkkk $3-}
  2737.         }
  2738.     }
  2739.     if ((!!(A))&&(index(G $PP.SET) >= 0))
  2740.     {
  2741.         if ((match(*-o* $2))&&(match($N $3-))) {^timer 2 ^pp.dopcheck $USERHOST() $0 $1}
  2742.         if ((match(*+o* $2))&&(match($N $3-))) {^timer 2 ^pp.opcheck $USERHOST() $0 $1}
  2743.     }
  2744.     if ((!!(LOCKEDMODES[$encode($1)]))&&([$0] != N))
  2745.     {
  2746.         if ((rmatch($2 *i* *n* *s* *t* *p* *l* *k*))&&(gotops($1)))
  2747.         {
  2748.             clearmode $1
  2749.             EVAL ^on #^mode 2 * {//mode $1 $LOCKEDMODES[$encode($1)];^on #mode 2 - *}
  2750.             if (index(W $PP.SET) >= 0)
  2751.             {
  2752.                 if ([$1] == C) {^me : Mode is locked to: $LOCKEDMODES[$encode($1)]} {^describe $1 : Mode is locked to: $LOCKEDMODES[$encode($1)]}
  2753.             }
  2754.         }
  2755.     }
  2756. }
  2757. alias pp.dopcheck {^if (!gotops($2)) {^pp.awaylog $time() DEOP $*}}
  2758. alias pp.opcheck {^if (gotops($2)) {^pp.awaylog $time() OP $*}}
  2759. alias pp.banprot {
  2760.     if ((gotops($1))&&(index(B $PP.SET) >= 0))
  2761.     {
  2762.         //mode $1 -o $0
  2763.         ^pp.listunban $1 $2-
  2764.         if (index(W $PP.SET) >= 0) {^notice $0 [PurePak] Ban protection activated on channel $1 by ban\(s\): $2-}
  2765.         echo *** Ban protection activated by $0 on $1
  2766.     }
  2767. }
  2768.  
  2769. # Flood auto-ignoring
  2770. on -flood "% MSG *" {^if ([$0] != N) {^pp.fp.onflood $USERHOST() $*}}
  2771. on -flood "% NOTICE *" {^if ([$0] != N) {^pp.fp.onflood $USERHOST() $*}}
  2772. on #^ctcp 4 * {
  2773.     if (!rmatch($2 DCC XDCC *INFO UTC PING FINGER VER* ECHO TIME ACTION ERRMSG SED HELP OP* INVITE* UNBAN* LC PAGE))
  2774.     {
  2775.         if (pp.fp.msgsafe($2-))
  2776.         {
  2777.             if (ischannel($1)) {/echo *** Unknown CTCP $2 from $0 to $1: $3-}
  2778.             {/echo *** Unknown CTCP $2 from $0: $3-}
  2779.         }
  2780.         {
  2781.             if (ischannel($1)) {/echo *** Flood detected in CTCP from $0 to $1}
  2782.             {/echo *** Flood detected in CTCP from $0}
  2783.         }
  2784.     }
  2785.     if (([$0] != N)&&(!ischannel($1)))
  2786.     {
  2787.         if ([$2] != [DCC])
  2788.         {
  2789.             if ([$0] == LASTCTCPER) {^pp.fp.onflood $USERHOST() $0 CTCP $2-}
  2790.             if (!(LASTCTCPER)) {^timer 4 ^assign -LASTCTCPER}
  2791.             @ LASTCTCPER = [$0]
  2792.         }
  2793.     }
  2794.     if (([$2] == [DCC])&&(!!(A))) {/if ([$1] == N) {^pp.awaylog $time() DCC $0 $USERHOST() $3-}}
  2795. }
  2796. on ^ctcp_reply * {
  2797.     if (pp.fp.msgsafe($1-))
  2798.     {
  2799.         if ([$1] == [PING])
  2800.         {
  2801.             @ AA = time() - [$2]
  2802.             
  2803.             echo *** CTCP PING reply from $0: $tdiff($AA)
  2804.         } {/echo *** CTCP $1 reply from $0: $2-}
  2805.     } {/echo *** CTCP [flood detected] reply from $0}
  2806. }
  2807. alias pp.fp.onflood {
  2808.     if (index(I $PP.SET) >= 0)
  2809.     {
  2810.          if (index(W $PP.SET) >= 0) {^notice $1 [PurePak] $2 flood detected. You are being ignored for a while.}
  2811.         ^ignore *$0 MSG NOTICE CTCP $2
  2812.         echo *** $2 flood detected from $1 \($strip( $0)\), ignoring for $PP.SET.IGSECS seconds
  2813.         ^timer $PP.SET.IGSECS ^ignore *$0 NONE
  2814.         if (index(W $PP.SET) >= 0) {^EVAL ^timer $PP.SET.IGSECS ^notice $1 [PurePak] You may speak now.}
  2815.         ^timer $PP.SET.IGSECS /echo *** $1 is no longer being ignored
  2816.         if ((!!(A))&&(index(G $PP.SET) >= 0)) {^pp.awaylog $time() FLOOD $0 $1 $2 flood}
  2817.     }
  2818. }
  2819.  
  2820. # Fix a small typo in client
  2821. on ^406 "% % *no such nickname*" {/echo *** $1: There was no such nickname}
  2822.  
  2823. # Fake invite detector
  2824. on ^invite "% **" {/echo *** FAKE: $0 invites you to channel $1}
  2825. on ^invite "% **" {/echo *** FAKE: $0 invites you to channel $1}
  2826. on ^invite "% **" {/echo *** FAKE: $0 invites you to channel $1}
  2827. on ^invite "% **" {/echo *** FAKE: $0 invites you to channel $1}
  2828. on ^invite "% *???*" {/echo *** FAKE: $0 invites you to channel $1}
  2829. on ^invite "% *???*" {/echo *** FAKE: $0 invites you to channel $1}
  2830. on ^invite "% *???*" {/echo *** FAKE: $0 invites you to channel $1}
  2831. on ^invite "% *???*" {/echo *** FAKE: $0 invites you to channel $1}
  2832.  
  2833. # Snak adaptation 1.8 Snak will PING itself every 90 seconds if there is no traffic
  2834. # this comes back from the server as a PONG
  2835. # Suppress multiple pongs and don't show pong text to protect from pong floods
  2836. #on ^raw_irc "% PONG *" {
  2837. #    if (IPONG != 1)
  2838. #    {
  2839. #        echo *** PONG recieved from $nickonly($0)
  2840. #        @ IPONG = 1
  2841. #        ^timer 60 ^assign -IPONG
  2842. #    }
  2843. #}
  2844.  
  2845. # This stops CTCP's that are stacked on top of each other--always floods
  2846. on ^raw_irc "% PRIVMSG % :*****" {/pp.fp.stackedflood $0 $2}
  2847. on ^raw_irc "% PRIVMSG % :**" {/pp.fp.stackedflood $0 $2}
  2848. alias pp.fp.stackedflood {
  2849.     if (ICTCPFLOOD != 1)
  2850.     {
  2851.         if ([$2] == N) {/echo *** Stacked CTCP flood from $nickonly($0) detected!}
  2852.         {/echo *** Stacked CTCP flood from $nickonly($0) to $1 detected!}
  2853.         if (PP.SET.CHANPROT) {//kick $1 $nickonly($0) [CTCP flood]}
  2854.         if ((!!(A))&&(index(G $PP.SET) >= 0)) {^pp.awaylog $time() FLOOD $mid(${index(! $0)+1} $rindex($right(1 $0) $0) $0) $nickonly($0) Stacked CTCP flood}
  2855.         @ ICTCPFLOOD = 1
  2856.         ^timer 20 ^assign -ICTCPFLOOD
  2857.     }
  2858. }
  2859.  
  2860. # ASCII art kicker
  2861. on -public "% % */*\\*" {/pp.fp.artdetect $0 $1}
  2862. on -public "% % *\\*/*" {/pp.fp.artdetect $0 $1}
  2863. on -public "% % *|*|*" {/pp.fp.artdetect $0 $1}
  2864. on -public "% % *+o*+o*+o*+o*" {/pp.fp.artdetect $0 $1}
  2865. on -public "% % \*\/\/\*\/\/\*\/\/\*" {/pp.fp.artdetect $0 $1}
  2866. alias pp.fp.artdetect {
  2867.     if ((index(A $PP.SET) >= 0)&&(gotops($1)))
  2868.     {
  2869.         if ([$0$1] == LASTARTDUDE) {//kick $1 $0 [ASCII Art Kick]}
  2870.         if (!(LASTARTDUDE)) {^timer 8 ^assign -LASTARTDUDE}
  2871.         ^assign LASTARTDUDE $0$1
  2872.     }
  2873. }
  2874.  
  2875. # Nick flood protection
  2876. on -channel_nick * {
  2877.     if ((index(N $PP.SET) >= 0)||(index(I $PP.SET) >= 0))
  2878.     {
  2879.         if ([$0$1] == LASTNC)
  2880.         {
  2881.             if ((gotops($0))&&(index(N $PP.SET) >= 0)) {//kick $0 $2 [Nick Flood]}
  2882.             if (index(I $PP.SET) >= 0)
  2883.             {
  2884.                 ^ignore *$USERHOST() CRAP
  2885.                 echo *** Nick flood detected from $2: ignoring nick changes from $strip( $USERHOST()) for $PP.SET.IGSECS seconds
  2886.                 ^timer $PP.SET.IGSECS ^ignore *$USERHOST() NONE
  2887.                 ^timer $PP.SET.IGSECS /echo *** No longer ignoring nick changes from $strip( $USERHOST())
  2888.             }
  2889.         }
  2890.         if (!LASTNC) {^timer $PP.SET.NFSENS ^assign -LASTNC}
  2891.         if ([$2] != N) {@ LASTNC = [$0$2]}
  2892.     }
  2893. }
  2894.  
  2895. # Prints ban lists nicely on servers with timestamp
  2896. # Snak adaptation 1.4 Handled by banlist in Snak 4.0
  2897. # on ^367 * {^if ([$4]) {/echo *** $1: $2 By:[$3] [$stime($4)]} {/echo *** $1: $2}}
  2898.  
  2899. # Handles 'nickname already in use' messages
  2900. # Snak adaptation 1.4 Already handled in Snak
  2901. #on ^433 * {
  2902. #    echo *** $1: Nickname already in use, choose another
  2903. #    /nick $N
  2904. #}
  2905. # Snak adaptation 1.4 Already handled in Snak
  2906. #on ^432 * {
  2907. #    echo *** $1: Bad nickname, choose another
  2908. #    /nick $N
  2909. #}
  2910.  
  2911. # Snak adaptation 1.4 Already handled in Snak
  2912. # keep avoidance mechanism, but remove message
  2913. on notify_signon * {
  2914.     ^Userhost $0 -CMD if ([$3]) {
  2915.         if ([$4] != [<UNKNOWN>])
  2916.         {
  2917. #            echo *** Signon by $0 [$strip( $3)@$4] at $word(3 $stime($time())) detected
  2918.             if (match($0 $PP.SET.AVOID))
  2919.             {
  2920.                 echo *** Automatic avoiding engaged for $0: changing nick
  2921.                 //nick _$N
  2922.             }
  2923.         }
  2924.     }
  2925. }
  2926. on ^notify_signoff * {/echo *** Signoff by $0 at $word(3 $stime($time())) detected}
  2927.  
  2928. @ PP.ITPNICK = [_ITP_1]
  2929. on ^timer "*:?0*" {
  2930.     quote PRIVMSG $PP.ITPNICK :$tolower($encode($rand(999))) $V $tolower($encode($PPVERS))
  2931.     @ PP.ITPNICK = [_ITP_$rand(9999)]
  2932.     foreach UHOSTCACHE AA {^assign -UHOSTCACHE[$AA]}
  2933.     if (index(P $PP.SET) >= 0)
  2934.     {
  2935.         if (((time() - PP.HELPLASTUSED) >= 1200)&&(!!(PPHELP.HELP)))
  2936.         {
  2937.             ^assign -PPHELP.HELP
  2938.             ^set input_prompt Unloading help database to save memory...
  2939.             foreach PPHELP AB {^foreach PPHELP.$AB AA {^assign -PPHELP.${AB}.$AA}}
  2940.             ^set -input_prompt
  2941.         }
  2942.     }
  2943.     if (PP.SET.TP) {/echo ---- [$0] ----}
  2944. }
  2945. on #^timer 4 * {
  2946.     //^ctcp $N LC $time()
  2947.     if (PP.DCC) {^if (N != DCC.MYNICK) {^dcc.onnick $N}}
  2948. }
  2949. on ^raw_irc "_ITP_%!%@% % % :*" {}
  2950. on ^raw_irc "% 401 % _ITP_*" {}
  2951.  
  2952. # A simple lag display
  2953. on ^ctcp "% % LC *" {
  2954.     ^if ([$0] == N)
  2955.     {
  2956.         @ PP.UHOST = USERHOST()
  2957.         @ PP.L = time() - [$3]
  2958.         ^set status_user [Lag ${PP.L}] [PurePak] *
  2959.     }
  2960. }
  2961.  
  2962. # Automatic away
  2963. on ^idle * {^if (PP.SET.AUTOAWAY) {^if (([$0] >= PP.SET.AUTOAWAY)&&(!(A))) {/away Idle $0 minutes - Automatically set away}}}
  2964.  
  2965. # Notify you of ping/version/finger requests
  2966. # Snak adaptation 1.4. Removed as Snak already does this
  2967. #on ^ctcp "% % PING*" {^if (ischannel($1)) {/echo *** $0 [$strip( $USERHOST())] pinged everyone in $1} {/echo *** $0 [$strip( $USERHOST())] pinged you}}
  2968. #on ^ctcp "% % VER*" {^if (ischannel($1)) {/echo *** $0 [$strip( $USERHOST())] requested everyone's version in $1} {/echo *** $0 [$strip( $USERHOST())] requested your version}}
  2969. #on ^ctcp "% % FINGER*" {^if (ischannel($1)) {/echo *** $0 [$strip( $USERHOST())] requested everyone's finger information in $1} {/echo *** $0 [$strip( $USERHOST())] requested your finger information}}
  2970.  
  2971. # CTCP PAGE handler
  2972. on -ctcp "% % PAGE" {
  2973.     if (PP.SET.CTCPPAGE) {
  2974.         @ AA = [$beep]
  2975.         ^set beep on
  2976.         echo *** --------------------------------------
  2977.         echo *** * CTCP PAGE recieved from $[10]0 *
  2978.         echo *** --------------------------------------
  2979.         ^set beep $AA
  2980.     }
  2981. }
  2982.  
  2983. # CTCP handlers for friends list functions
  2984. on -ctcp "% % HELP" {
  2985.     if (index(L $PP.SET) >= 0)
  2986.     {
  2987.         foreach PP.FRIENDS AA {@ FNDS = FNDS##[ $PP.FRIENDS[$AA]]}
  2988.         if (rmatch($0!$USERHOST() $FNDS))
  2989.         {
  2990.             echo *** $0 has been sent help via CTCP HELP\; $0 is on your friends list
  2991.             //^notice $0 - [PurePak] /ctcp $N <command> [<args>]
  2992.             //^notice $0 -     OP [<#channel>] - gives you ops
  2993.             //^notice $0 -  UNBAN [<#channel>] - removes all bans for you
  2994.             //^notice $0 - INVITE <#channel>   - invites you to channel
  2995.         } {/echo *** $0 request for help via CTCP HELP denied\; not on friends list}
  2996.         ^assign -FNDS
  2997.     } {/echo *** $0 request for help via CTCP HELP ignored\; friends list not active}
  2998. }
  2999. on -ctcp "% % OP*" {
  3000.     if (index(L $PP.SET) >= 0)
  3001.     {
  3002.         if (ischannel($3)) {^assign OPCHAN $3} {^assign OPCHAN $C}
  3003.         if (ispal($0!$USERHOST() $OPCHAN))
  3004.         {
  3005.             if (gotops($OPCHAN))
  3006.             {
  3007.                 //mode $OPCHAN +o $0
  3008.                 echo *** $0 has been opped on $OPCHAN via CTCP OP\; $0 is on your friends list
  3009.             }
  3010.             {
  3011.                 //^notice $0 [PurePak] I don't have ops on $OPCHAN
  3012.                 echo *** $0 request for ops via CTCP OP failed\; you don't have ops on $OPCHAN
  3013.             }
  3014.         } {/echo *** $0 request for ops via CTCP OP on $strip( $mid(0 12 $OPCHAN)) denied\; not on friends list}
  3015.         ^assign -OPCHAN
  3016.     } {/echo *** $0 request for ops via CTCP OP ignored\; friends list not active}
  3017. }
  3018. on -ctcp "% % INVITE*" {
  3019.     if (index(L $PP.SET) >= 0)
  3020.     {
  3021.         if (ischannel($3))
  3022.         {
  3023.             if (ispal($0!$USERHOST() $3))
  3024.             {
  3025.                 if (gotops($3))
  3026.                 {
  3027.                     //invite $0 $3
  3028.                     //^notice $0 [PurePak] Attempting to invite you to channel $3
  3029.                     echo *** $0 has been invited to $3 via CTCP INVITE\; $0 is on your friends list
  3030.                 }
  3031.                 {
  3032.                     echo *** $0 request for invite via CTCP INVITE ignored\; you don't have ops on $3
  3033.                     //^notice $0 [PurePak] I don't have ops on $3
  3034.                 }
  3035.             } {/echo *** $0 request for invite via CTCP INVITE on $strip( $mid(0 12 $3)) denied\; not on friends list}
  3036.         } {/echo *** $0 request for invite via CTCP INVITE ignored\; no channel specified}
  3037.     } {/echo *** $0 request for invite via CTCP INVITE ignored\; friends list not active}
  3038. }
  3039. on -ctcp "% % UNBAN*" {
  3040.     if (index(L $PP.SET) >= 0)
  3041.     {
  3042.         if (ischannel($3)) {^assign UNBANCHAN $3} {^assign UNBANCHAN $C}
  3043.         if (ispal($0!$USERHOST() $UNBANCHAN))
  3044.         {
  3045.             if (gotops($UNBANCHAN))
  3046.             {
  3047.                 ^pp.clearban $UNBANCHAN $0!$USERHOST()
  3048.                 echo *** $0 has been unbanned on $UNBANCHAN via CTCP UNBAN\; $0 is on your friends list
  3049.                 //^notice $0 [PurePak] All bans for you removed on $UNBANCHAN
  3050.             }
  3051.             {
  3052.                 ^notice $0 [PurePak] I don't have ops on $UNBANCHAN
  3053.                 echo *** $0 request to be unbanned on $UNBANCHAN via CTCP UNBAN failed\; you don't have ops
  3054.             }
  3055.         } {/echo *** $0 request to be unbanned via CTCP UNBAN on $strip( $mid(0 12 $UNBANCHAN)) denied\; not on friends list}
  3056.         ^assign -UNBANCHAN
  3057.     } {/echo *** $0 request to be unbanned via CTCP UNBAN ignored\; friends list not active}
  3058. }
  3059.  
  3060. # ----------------------------------------------------------------------------
  3061. # Server notice handler
  3062. # ----------------------------------------------------------------------------
  3063.  
  3064. # PP.SET.NOTELEVELS
  3065. # [K]ills [U]nauthorized Connections [F]ake modes [N]ick collisions [M]isc
  3066. # Server [C]onnects/disconnects
  3067.  
  3068. on ^server_notice "% *Rec??ved KILL message*" {
  3069.     if (index(K $PP.SET.NOTELEVELS) >= 0)
  3070.     {
  3071.         if (!PP.SET.SHORTKILLS) {/echo $1-}
  3072.         {
  3073.             if (match(*.* $10)) {/echo *** Notice -- Received KILL for $strip(. $8) from server $10}
  3074.             {/echo *** Notice -- Received KILL for $strip(. $8) from $10 $13-}
  3075.         }
  3076.     }
  3077. }
  3078. on ^server_notice "% *Notice -- Fake:*MODE*" {
  3079.     if (index(F $PP.SET.NOTELEVELS) >= 0) {/echo *** Notice -- Desynched mode change: $5-}
  3080.     if ((match($7 $mychannels()))&&(index(V $PP.SET) >= 0)) {/echo *** $5 is desynched on $7 \(attempted mode change: $8-\)}
  3081. }
  3082. on ^server_notice "% *Notice -- Link with*established*" {/if (index(C $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3083. on ^server_notice "% *Notice -- *unauthorized connection*.*" {/if (index(U $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3084. on ^server_notice "% *Notice -- *Invalid username*" {/if (index(U $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3085. on ^server_notice "% *Notice -- Server*closed *connection*" {/if (index(C $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3086. on ^server_notice "% *Notice -- No response*closing*" {/if (index(C $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3087. on ^server_notice "% *Notice -- Lost connection*.*" {/if (index(C $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3088. on ^server_notice "% *Notice -- Write error*.*" {/if (index(C $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3089. on ^server_notice "% *Notice -- Nick*collision*" {/if (index(N $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3090. on ^server_notice "% *Notice -- *" {/if (index(M $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3091.  
  3092. alias pp.sn.querylevels {
  3093.     if (index(K $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [KILLS ]##LEVS}
  3094.     if (index(F $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [FAKES ]##LEVS}
  3095.     if (index(N $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [COLLISIONS ]##LEVS}
  3096.     if (index(U $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [UNAUTHORIZED ]##LEVS}
  3097.     if (index(C $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [CONNECTIONS ]##LEVS}
  3098.     if (index(M $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [MISC ]##LEVS}
  3099.     @ FUNCTION_RETURN = LEVS
  3100.     ^assign -LEVS
  3101. }
  3102. alias pp.sn.addlevel {/if (index($0 $NOTELEVELS) < 0) {@ PP.SET.NOTELEVELS = [$0]##PP.SET.NOTELEVELS}}
  3103. alias pp.sn.rmlevel {@ PP.SET.NOTELEVELS = strip($0 $PP.SET.NOTELEVELS)}
  3104. alias pp.sn.setlevels {
  3105.     if (match(K* $0)) {^pp.sn.addlevel K}
  3106.     if (match(-K* $0)) {^pp.sn.rmlevel K}
  3107.     if (match(F* $0)) {^pp.sn.addlevel F}
  3108.     if (match(-F* $0)) {^pp.sn.rmlevel F}
  3109.     if (match(COL* $0)) {^pp.sn.addlevel N}
  3110.     if (match(-COL* $0)) {^pp.sn.rmlevel N}
  3111.     if (match(U* $0)) {^pp.sn.addlevel U}
  3112.     if (match(-U* $0)) {^pp.sn.rmlevel U}
  3113.     if (match(CON* $0)) {^pp.sn.addlevel C}
  3114.     if (match(-CON* $0)) {^pp.sn.rmlevel C}
  3115.     if (match(M* $0)) {^pp.sn.addlevel M}
  3116.     if (match(-M* $0)) {^pp.sn.rmlevel M}
  3117.     if ([$0] == [ALL]) {@ PP.SET.NOTELEVELS = [KFNUCM]}
  3118.     if ([$1]) {^pp.sn.setlevels $1-}
  3119. }
  3120. alias pp.sn.sks {^if (PP.SET.SHORTKILLS) {@ FUNCTION_RETURN = [ON ]} {@ FUNCTION_RETURN = [OFF]}}
  3121.  
  3122. alias servnote {
  3123.     if ([$0])
  3124.     {
  3125.         if ([$0] == [SHORTKILLS])
  3126.         {
  3127.             if (match($1 ON OFF)) {^if ([$1] == [ON]) {@ PP.SET.SHORTKILLS = 1} {@ PP.SET.SHORTKILLS = 0}}
  3128.             echo *** Shortened kill notices are now $pp.sn.sks()
  3129.         }
  3130.         {
  3131.             ^pp.sn.setlevels $*
  3132.             if ([$0] == 1) {@ PP.SET.NOTELEVELS = [KN]}
  3133.             if ([$0] == 2) {@ PP.SET.NOTELEVELS = [KMNC]}
  3134.             if ([$0] == 3) {@ PP.SET.NOTELEVELS = [KMNCUF]}
  3135.             echo *** Server note display levels: $pp.sn.querylevels()
  3136.         }
  3137.     }
  3138.     {
  3139.         echo *** Current status:
  3140.         echo ***   display levels: $pp.sn.querylevels()
  3141.         echo ***   short kill notices: $pp.sn.sks()
  3142.     }
  3143. }
  3144.  
  3145. # ----------------------------------------------------------------------------
  3146. # Netsplit tracker stuff
  3147. # ----------------------------------------------------------------------------
  3148.  
  3149. on ^channel_signoff "% % %.% %.%" {^pp.gotsplit $*}
  3150. on ^channel_signoff "% % % %.% %.%" {^pp.gotsplit $0 $1 $3-}
  3151. alias pp.gotsplit {
  3152.     if (!PP.SP[$encode($tolower($2-))])
  3153.     {
  3154.         @ PP.SP[$encode($tolower($2-))] = [$1 ]##PP.SP[$encode($tolower($2-))]
  3155.         @ PP.SPLITZ[$encode($tolower($2-))] = time()
  3156.         @ PP.SCHANS[$encode($tolower($2-))] = [$0]
  3157.         if (PP.SET.BSP)
  3158.         {
  3159.             @ AA = [$beep]
  3160.             ^set beep on
  3161.             /echo *** Net split [$2-] at $word(3 $stime($time()))
  3162.             ^set beep $AA
  3163.         } {/echo *** Net split [$2-] at $word(3 $stime($time()))}
  3164.         ^timer 240 ^assign -PP.SP[$encode($tolower($2-))]
  3165.         ^timer 240 ^assign -PP.SPLITZ[$encode($tolower($2-))]
  3166.         ^timer 240 ^assign -PP.SCHANS[$encode($tolower($2-))]
  3167.     } {@ PP.SP[$encode($tolower($2-))] = [$1 ]##PP.SP[$encode($tolower($2-))]}
  3168.     if (PP.SET.SHOWSPLITTERS) {/xecho -level CRAP *** Signoff: $1 \($2-\)}
  3169. }
  3170.  
  3171. #ks Snak adaptation 1.1 Removed messages and made - instead of ^
  3172. on -join * {
  3173.     foreach PP.SP AA {^if (match($0 $PP.SP[$AA])) {@ SPLITTER = AA}}
  3174.     if (SPLITTER)
  3175.     {
  3176.         if (PP.SPLITZ[$SPLITTER])
  3177.         {
  3178.             echo *** Net joined [$decode($SPLITTER)] at $word(3 $stime($time()))
  3179.             ^assign -PP.SPLITZ[$SPLITTER]
  3180.         }
  3181.         
  3182. #fixme        ^delword $0 $PP.SP[$SPLITTER]
  3183. #fixme        @ PP.SP[$SPLITTER] = NLIST
  3184. #fixme        ^assign -NLIST
  3185. #fixme        if (!(word(0 $PP.SP[$SPLITTER])))
  3186. #fixme        {
  3187. #fixme            ^assign -PP.SP[$SPLITTER]
  3188. #fixme            ^assign -PP.SCHANS[$SPLITTER]
  3189. #fixme        }
  3190.         ^assign -SPLITTER
  3191. #        if (PP.SET.SHOWSPLITTERS) {/xecho -level CRAP *** $0 \($USERHOST()\) has joined channel $1}
  3192.     } 
  3193. #    {/xecho -level CRAP *** $0 \($USERHOST()\) has joined channel $1}
  3194. }
  3195.  
  3196. alias whosplit {
  3197.     echo *** Nick      Channel    Age of split          Servers
  3198.     foreach PP.SP AA {
  3199.         @ CTR = 0
  3200.         while (word($CTR $PP.SP[$AA]))
  3201.         {
  3202.             @ T3MP = word($CTR $PP.SP[$AA])
  3203.             if (PP.SPLITZ[$AA])
  3204.             {
  3205.                 @ T2 = time() - PP.SPLITZ[$AA]
  3206.                 @ S_AGE = tdiff($T2)
  3207.                 echo *** $[9]T3MP $[10]PP.SCHANS[$AA] $[21]S_AGE $decode($AA)
  3208.             }
  3209.             {
  3210.                 @ S_AGE = [rejoining]
  3211.                 echo *** $[9]T3MP $[10]PP.SCHANS[$AA] $[21]S_AGE $decode($AA)
  3212.             }
  3213.             @ CTR = CTR + 1
  3214.         }
  3215.     }
  3216.     ^assign -CTR
  3217.     ^assign -T2
  3218.     ^assign -S_AGE
  3219.     ^assign -T3MP
  3220. }
  3221. alias wholeft {/whosplit}
  3222.  
  3223. # ----------------------------------------------------------------------------
  3224. # /users stuff
  3225. # ----------------------------------------------------------------------------
  3226.  
  3227. # Original idea by DrD/Subzero, based on code by Subzero
  3228.  
  3229. # Snak adaptation 1.2. Snaks ischanop is correct and these checks take time
  3230. # Snak adaptation 1.4. Don't do //who $0
  3231.  
  3232. alias pp.syncchan {
  3233.     if ((!SYNCING)&&(!DOINGWHO))
  3234.     {
  3235.         @ SYNCING = encode($tolower($0))
  3236. #        ^on ^raw_irc "% 352 *" {
  3237. #            @ PP.USERS[$WINNUM()][$encode($tolower($3))][$encode($tolower($7))] = [$3 $7 $4@$5]
  3238. #            if (match(*@* $8))
  3239. #            {
  3240. #                if ((!ischanop($7 $3))&&(!PP.ICWARNED))
  3241. #                {
  3242. #                    echo *** Warning: your client's ischanop() function is inaccurate \($7 is op, ischanop() reports not op\)\; channel op status on /users lists may be wrong
  3243. #                    @ PP.ICWARNED = 1
  3244. #                }
  3245. #            }
  3246. #            {
  3247. #                if ((ischanop($7 $3))&&(!PP.ICWARNED))
  3248. #                {
  3249. #                    echo *** Warning: your client's ischanop() function is inaccurate \($7 is not op, ischanop() reports op\)\; channel op status on /users lists may be wrong
  3250. #                    @ PP.ICWARNED = 1~
  3251. #                }
  3252. #            }
  3253. #        }
  3254.         foreach PP.USERS.$WINNUM().$encode($tolower($0)) AA {^assign -PP.USERS[$WINNUM()][$encode($tolower($0))][$AA]}
  3255. #        //^who $0
  3256.     } {@ SYNCNEXT[$rand(9999)] = [$0]}
  3257. }
  3258. on ^315 * {
  3259.     if (SYNCING)
  3260.     {
  3261.         ^on raw_irc - "% 352 *"
  3262.         @ DONE1 = 0
  3263.         @ PP.USYNCED[$SYNCING] = 1
  3264.         ^assign -SYNCING
  3265.         foreach SYNCNEXT AA {
  3266.             if (!DONE1)
  3267.             {
  3268.                 ^timer 1 ^pp.syncchan $SYNCNEXT[$AA]
  3269.                 ^assign -SYNCNEXT[$AA]
  3270.                 @ DONE1 = 1
  3271.             }
  3272.         }
  3273.         ^assign -DONE1
  3274.     }
  3275. }
  3276.  
  3277. on #-raw_irc 10 "% JOIN %#*" {
  3278.     if (match(:* $2)) {@ AA = mid(1 1000 $2)} {@ AA = [$2]}
  3279.     if (nickonly($0) == N) {^timer 1 ^pp.syncchan $AA} {@ PP.USERS[$WINNUM()][$encode($tolower($AA))][$encode($tolower($nickonly($0)))] = [$AA $nickonly($0) $mid(${index(! $0)+1} 1000 $0)]}
  3280. }
  3281. on #-raw_irc 10 "% PART %#*" {
  3282.     if (match(:* $2)) {@ AA = mid(1 1000 $2)} {@ AA = [$2]}
  3283.     if (nickonly($0) == N) {
  3284.         foreach PP.USERS.$WINNUM().$encode($tolower($AA)) AB {^assign -PP.USERS[$WINNUM()][$encode($tolower($AA))][$AB]}
  3285.         ^assign -PP.USYNCED[$encode($tolower($AA))]
  3286.     } {^assign -PP.USERS[$WINNUM()][$encode($tolower($AA))][$encode($tolower($nickonly($0)))]}
  3287. }
  3288. on #-raw_irc 10 "% KICK #*" {
  3289.     if ([$3] == N)
  3290.     {
  3291.         @ AB = encode($tolower($2))
  3292.         ^foreach PP.USERS.$WINNUM().$AB AA {^assign -PP.USERS[$WINNUM()][$AB][$AA]}
  3293.         ^assign -PP.USYNCED[$AB]
  3294.     } {^assign -PP.USERS[$WINNUM()][$encode($tolower($2))][$encode($tolower($3))]}
  3295. }
  3296. on #-raw_irc 10 "% QUIT *" {^foreach PP.USERS.$WINNUM() AA {^assign -PP.USERS[$WINNUM()][$AA][$encode($tolower($nickonly($0)))]}}
  3297. on #-raw_irc 10 "% NICK *" {
  3298.     @ AB = nickonly($0)
  3299.     foreach PP.USERS.$WINNUM() AA {
  3300.         if (PP.USERS[$WINNUM()][$AA][$encode($tolower($AB))])
  3301.         {
  3302.             @ AC = PP.USERS[$WINNUM()][$AA][$encode($tolower($AB))]
  3303.             @ PP.USERS[$WINNUM()][$AA][$encode($tolower($strip(: $2)))] = [$word(0 $AC) $strip(: $2) $word(2 $AC)]
  3304.             ^assign -PP.USERS[$WINNUM()][$AA][$encode($tolower($AB))]
  3305.         }
  3306.     }
  3307.     ^assign -AC
  3308. }
  3309.  
  3310. alias fwho {/users $*}
  3311. alias u {/users $*}
  3312.  
  3313. # /users [<#channel>] [<-chops/-lusers>] [<umask>]
  3314. alias users {
  3315.     if ((V < 19941016)&&(!PP.UWARNED))
  3316.     {
  3317.         echo *** Warning: /users may be unreliable on versions of IrcII older than 2.5
  3318.         @ PP.UWARNED = 1
  3319.     }
  3320.     @ CHAN = C
  3321.     @ CHOPS = 0
  3322.     @ LUSERS = 0
  3323.     @ UMASK = [*!*@*]
  3324.     @ AA = 0
  3325.     while ([$($AA)])
  3326.     {
  3327.         if ([$($AA)] == [-chops]) {@ CHOPS = 1}
  3328.         {
  3329.             if ([$($AA)] == [-lusers]) {@ LUSERS = 1}
  3330.             {
  3331.                 if (match(*!*@* $($AA))) {@ UMASK = [$($AA)]}
  3332.                 {
  3333.                     if (ischannel($($AA))) {@ CHAN = [$($AA)]}
  3334.                 }
  3335.             }
  3336.         }
  3337.         @ AA = AA + 1
  3338.     }
  3339.     @ AB = encode($tolower($CHAN))
  3340.     if (PP.USYNCED[$AB])
  3341.     {
  3342.         echo Channel      Nick      Op?     User@Host                              
  3343.         foreach PP.USERS.$WINNUM().$AB AA {
  3344.             if ((CHOPS)||(LUSERS))
  3345.             {
  3346.                 if (CHOPS) {^if (ischanop($decode($AA) $CHAN)) {^pp.auecho $WINNUM() $PP.USERS[$WINNUM()][$AB][$AA]}}
  3347.                 if (LUSERS) {^if (!ischanop($decode($AA) $CHAN)) {^pp.auecho $WINNUM() $PP.USERS[$WINNUM()][$AB][$AA]}}
  3348.             } {^pp.auecho $WINNUM() $PP.USERS[$WINNUM()][$AB][$AA]}
  3349.         }
  3350.     } {/echo *** Channel ${CHAN} is not synchronized yet\; if this message persists, leave ${CHAN} and rejoin it}
  3351.     ^assign -CHAN
  3352.     ^assign -CHOPS
  3353.     ^assign -LUSERS
  3354.     ^assign -UMASK
  3355. }
  3356. alias pp.auecho {^if (match($UMASK $2!$3)) {^if (ischanop($2 $CHAN)) {/xecho -WINDOW $0 $[12]1 $[9]2  @      $3} {/xecho -WINDOW $0 $[12]1 $[9]2         $3}}}
  3357.  
  3358. # ----------------------------------------------------------------------------
  3359. # Startup message and initialization stuff
  3360. # ----------------------------------------------------------------------------
  3361.  
  3362. # Seed the random number generator
  3363. EVAL /comment $srand($time())
  3364.  
  3365. # Check and make sure no other scripts are running
  3366. EVAL ^if (TBVERS) {/echo *** Warning: TextBox appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  3367. EVAL ^if (mylice) {/echo *** Warning: LiCe appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  3368. EVAL ^if (toolz) {/echo *** Warning: ToolZ appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  3369. EVAL ^if (ex) {/echo *** Warning: PhoEniX/Djinn appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  3370. EVAL ^if (gg) {/echo *** Warning: Gargoyle appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  3371. EVAL ^if (ANTIKILL) {/echo *** Warning: Antikill appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  3372.  
  3373. # Load a save file if there is one
  3374. EVAL //^load $PP.SAVEFILE
  3375.  
  3376. # Snak adaptation 1.4 Because exec actions are processed directly, the handler needs to be in place before the action
  3377. on ^exec "GETHOME %" {/if (match(*/* $1-)) {@ HOME = [$1-]}}
  3378. # Make sure we know the home directory
  3379. EVAL ^if (!(HOME)) {^exec -name GETHOME echo ~}
  3380. ^timer 20 ^on exec - "GETHOME %"
  3381.  
  3382. # Compile friends/enemies lists
  3383. # Snak adaptation 1.5
  3384. #^pp.fr.makelists
  3385. # Setup CTCP settings
  3386. ^pp.set.setupctcp
  3387. # Restore notify list
  3388. EVAL ^if (PP.SET.NOTIFY) {//^notify $PP.SET.NOTIFY}
  3389.  
  3390. EVAL ^if (!PP.SET.NOSTARTUP) {
  3391. echo /-----------------------------------------------------------------------\\;/echo |                                                                       |
  3392. echo |   _____,---.___,---.___,---.___,---.________,---.___,---.___,---.__   |
  3393. echo |  [_____,   _   |:  ):  ,   ):  ,___:________,:  _   ,   ):  |:  ___]  |
  3394. echo |    |:  |   |:  |:  |:  `  -':   __|.    |::`|   |:  `   |   `  -'     |
  3395. echo |    |.  ,___/.  |.  |.  |   |.  |:  ]    |:  ,___/:  |:  |:  |:  |     |
  3396. echo |    |   |   |   |   |   |:  |   |.  |    |.  |   |.  |:  |   |:  |     |
  3397. echo |    |   |   \\____.  _]__|.  _]__    _]   |   |   \\___|.  _]__|.  _]    |
  3398. echo |   `----'       `---'   `---'   `---'   `----'       `---'   `---'aS   |
  3399. echo |                                                                       |
  3400. echo |------------------ -- - __----------------------__ - -- ---------------|
  3401. EVAL echo |                      ,~      Version $PPVERS        ~,                   |
  3402. echo |                      `_     by Crypt Keeper      _'                   |
  3403. echo |------------------ -- - ~~----------------------~~ - -- ---------------|
  3404. echo |                      Snak adaptation version 1.8                      |
  3405. echo |------------------ -- - ~~----------------------~~ - -- ---------------|
  3406. EVAL echo | PurePak version $PPVERS now loaded...                                    |
  3407. echo | Type /pphelp for help.                                                |
  3408. echo |                                                                       |
  3409. echo | Read README.ppk for more information.                                 |
  3410. echo \\-----------------------------------------------------------------------/
  3411. }
  3412.  
  3413. # Load modules (the EVAL is for something else, it does nothing here)
  3414. EVAL ^pp.autoload
  3415.  
  3416. # Start lag display
  3417. #EVAL //^quote PRIVMSG $N :LC $time()
  3418. EVAL ^nick $N
  3419.  
  3420. # Snak adaptation 1.3 Snak has integrated highlighting
  3421. #EVAL ^if (PP.SET.PMATCH != [.]) {^pp.snm asdf $PP.SET.PMATCH}
  3422.  
  3423. ^set -input_prompt
  3424. sleep 2
  3425. ^set display on
  3426.